<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="generator" content="quarto-1.7.32">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Themes and Styles – modelsummary: Data and Model Summaries in R</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
  width: 0.8em;
  margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */ 
  vertical-align: middle;
}
/* CSS for syntax highlighting */
html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
  { counter-reset: source-line 0; }
pre.numberSource code > span
  { position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
  { content: counter(source-line);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
  }
pre.numberSource { margin-left: 3em;  padding-left: 4px; }
div.sourceCode
  {   }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
</style>

<script src="../site_libs/quarto-nav/quarto-nav.js"></script>
<script src="../site_libs/quarto-nav/headroom.min.js"></script>
<script src="../site_libs/clipboard/clipboard.min.js"></script>
<script src="../site_libs/quarto-search/autocomplete.umd.js"></script>
<script src="../site_libs/quarto-search/fuse.min.js"></script>
<script src="../site_libs/quarto-search/quarto-search.js"></script>
<meta name="quarto:offset" content="../">
<link href="../man/modelsummary.html" rel="next">
<link href="../vignettes/modelsummary_extension.html" rel="prev">
<script src="../site_libs/quarto-html/quarto.js" type="module"></script>
<script src="../site_libs/quarto-html/tabsets/tabsets.js" type="module"></script>
<script src="../site_libs/quarto-html/popper.min.js"></script>
<script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
<script src="../site_libs/quarto-html/anchor.min.js"></script>
<link href="../site_libs/quarto-html/tippy.css" rel="stylesheet">
<link href="../site_libs/quarto-html/quarto-syntax-highlighting-37eea08aefeeee20ff55810ff984fec1.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="../site_libs/bootstrap/bootstrap.min.js"></script>
<link href="../site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="../site_libs/bootstrap/bootstrap-555d7fa6eb067a0c9d334ac7ef1a20f4.min.css" rel="stylesheet" append-hash="true" id="quarto-bootstrap" data-mode="light"><script id="quarto-search-options" type="application/json">{
  "location": "navbar",
  "copy-button": false,
  "collapse-after": 3,
  "panel-placement": "end",
  "type": "overlay",
  "limit": 50,
  "keyboard-shortcut": [
    "f",
    "/",
    "s"
  ],
  "show-item-context": false,
  "language": {
    "search-no-results-text": "No results",
    "search-matching-documents-text": "matching documents",
    "search-copy-link-title": "Copy link to search",
    "search-hide-matches-text": "Hide additional matches",
    "search-more-match-text": "more match in this document",
    "search-more-matches-text": "more matches in this document",
    "search-clear-button-title": "Clear",
    "search-text-placeholder": "",
    "search-detached-cancel-button-title": "Cancel",
    "search-submit-button-title": "Submit",
    "search-label": "Search"
  }
}</script><link href="../site_libs/htmltools-fill-0.5.8.1/fill.css" rel="stylesheet">
<script src="../site_libs/htmlwidgets-1.6.4/htmlwidgets.js"></script><link href="../site_libs/datatables-css-0.0.0/datatables-crosstalk.css" rel="stylesheet">
<script src="../site_libs/datatables-binding-0.33/datatables.js"></script><script src="../site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script><link href="../site_libs/dt-core-1.13.6/css/jquery.dataTables.min.css" rel="stylesheet">
<link href="../site_libs/dt-core-1.13.6/css/jquery.dataTables.extra.css" rel="stylesheet">
<script src="../site_libs/dt-core-1.13.6/js/jquery.dataTables.min.js"></script><link href="../site_libs/crosstalk-1.2.1/css/crosstalk.min.css" rel="stylesheet">
<script src="../site_libs/crosstalk-1.2.1/js/crosstalk.min.js"></script>
</head>
<body class="nav-sidebar floating nav-fixed quarto-light">

<div id="quarto-search-results"></div>
  <header id="quarto-header" class="headroom fixed-top"><nav class="navbar navbar-expand-lg " data-bs-theme="dark"><div class="navbar-container container-fluid">
      <div class="navbar-brand-container mx-auto">
    <a class="navbar-brand" href="../index.html">
    <span class="navbar-title">modelsummary: Data and Model Summaries in R</span>
    </a>
  </div>
            <div id="quarto-search" class="" title="Search"></div>
          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" role="menu" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
  <span class="navbar-toggler-icon"></span>
</button>
          <div class="collapse navbar-collapse" id="navbarCollapse">
            <ul class="navbar-nav navbar-nav-scroll ms-auto">
<li class="nav-item">
    <a class="nav-link active" href="../vignettes/get_started.html" aria-current="page"> 
<span class="menu-text">Get started</span></a>
  </li>  
  <li class="nav-item compact">
    <a class="nav-link" href="https://github.com/vincentarelbundock/modelsummary/"> <i class="bi bi-github" role="img" aria-label="modelsummary GitHub">
</i> 
<span class="menu-text"></span></a>
  </li>  
</ul>
</div> <!-- /navcollapse -->
            <div class="quarto-navbar-tools">
</div>
      </div> <!-- /container-fluid -->
    </nav><nav class="quarto-secondary-nav"><div class="container-fluid d-flex">
      <button type="button" class="quarto-btn-toggle btn" data-bs-toggle="collapse" role="button" data-bs-target=".quarto-sidebar-collapse-item" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
        <i class="bi bi-layout-text-sidebar-reverse"></i>
      </button>
        <nav class="quarto-page-breadcrumbs" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="../vignettes/appearance.html">Themes and Styles</a></li></ol></nav>
        <a class="flex-grow-1" role="navigation" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">      
        </a>
    </div>
  </nav></header><!-- content --><div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
<!-- sidebar -->
  <nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation floating overflow-auto"><div class="sidebar-menu-container"> 
    <ul class="list-unstyled mt-1">
<li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../vignettes/get_started.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text">Getting started</span></a>
  </div>
</li>
        <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../vignettes/datasummary.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text">Data Summaries</span></a>
  </div>
</li>
        <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../vignettes/modelsummary.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text">Model Summaries</span></a>
  </div>
</li>
        <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../vignettes/modelplot.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text">Model Plots</span></a>
  </div>
</li>
        <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../vignettes/modelsummary_extension.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text">Custom</span></a>
  </div>
</li>
        <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../vignettes/appearance.html" class="sidebar-item-text sidebar-link active">
 <span class="menu-text">Themes and Styles</span></a>
  </div>
</li>
        <li class="sidebar-item sidebar-item-section">
      <div class="sidebar-item-container"> 
            <a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" role="navigation" aria-expanded="false">
 <span class="menu-text">Functions</span></a>
          <a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" role="navigation" aria-expanded="false" aria-label="Toggle section">
            <i class="bi bi-chevron-right ms-2"></i>
          </a> 
      </div>
      <ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/modelsummary.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>modelsummary</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/modelplot.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>modelplot</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/datasummary.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>datasummary</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/datasummary_skim.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>datasummary_skim</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/datasummary_balance.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>datsummary_balance</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/datasummary_crosstab.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>datasummary_crosstab</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/datasummary_correlation.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>datasummary_correlation</code></span></a>
  </div>
</li>
          <li class="sidebar-item sidebar-item-section">
      <div class="sidebar-item-container"> 
            <a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" role="navigation" aria-expanded="false">
 <span class="menu-text">Formatting</span></a>
          <a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" role="navigation" aria-expanded="false" aria-label="Toggle section">
            <i class="bi bi-chevron-right ms-2"></i>
          </a> 
      </div>
      <ul id="quarto-sidebar-section-2" class="collapse list-unstyled sidebar-section depth2 ">
<li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/fmt_decimal.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>fmt_decimal</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/fmt_equivalence.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>fmt_equivalence</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/fmt_sci.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>fmt_sci</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/fmt_significant.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>fmt_significant</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/fmt_sprintf.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>fmt_sprintf</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/fmt_statistic.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>fmt_statistic</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/fmt_term.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>fmt_term</code></span></a>
  </div>
</li>
      </ul>
</li>
          <li class="sidebar-item sidebar-item-section">
      <div class="sidebar-item-container"> 
            <a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" role="navigation" aria-expanded="false">
 <span class="menu-text">Utilities</span></a>
          <a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" role="navigation" aria-expanded="false" aria-label="Toggle section">
            <i class="bi bi-chevron-right ms-2"></i>
          </a> 
      </div>
      <ul id="quarto-sidebar-section-3" class="collapse list-unstyled sidebar-section depth2 ">
<li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/get_estimates.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>get_estimates</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/get_gof.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>get_gof</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/coef_rename.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>coef_rename</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/dvnames.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>dvnames</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/gof_map.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>gof_map</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/datasummary_correlation_format.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>datasummary_correlation_format</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/config_modelsummary.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>config_modelsummary</code></span></a>
  </div>
</li>
          <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../man/update_modelsummary.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text"><code>update_modelsummary</code></span></a>
  </div>
</li>
      </ul>
</li>
      </ul>
</li>
        <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../NEWS.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text">News</span></a>
  </div>
</li>
        <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../LICENSE.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text">License</span></a>
  </div>
</li>
        <li class="sidebar-item">
  <div class="sidebar-item-container"> 
  <a href="../CITATION.html" class="sidebar-item-text sidebar-link">
 <span class="menu-text">Citation</span></a>
  </div>
</li>
    </ul>
</div>
</nav><div id="quarto-sidebar-glass" class="quarto-sidebar-collapse-item" data-bs-toggle="collapse" data-bs-target=".quarto-sidebar-collapse-item"></div>
<!-- margin-sidebar -->
    <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
        <nav id="TOC" role="doc-toc" class="toc-active"><h2 id="toc-title">On this page</h2>
   
  <ul>
<li>
<a href="#tinytable" id="toc-tinytable" class="nav-link active" data-scroll-target="#tinytable"><code>tinytable</code></a>
  <ul class="collapse">
<li><a href="#dot-alignement-in-latex" id="toc-dot-alignement-in-latex" class="nav-link" data-scroll-target="#dot-alignement-in-latex">Dot alignement in LaTeX</a></li>
  <li><a href="#removing-elements-e.g.-horizontal-rules" id="toc-removing-elements-e.g.-horizontal-rules" class="nav-link" data-scroll-target="#removing-elements-e.g.-horizontal-rules">Removing elements (e.g.&nbsp;horizontal rules)</a></li>
  </ul>
</li>
  <li><a href="#gt" id="toc-gt" class="nav-link" data-scroll-target="#gt"><code>gt</code></a></li>
  <li>
<a href="#themes" id="toc-themes" class="nav-link" data-scroll-target="#themes">Themes</a>
  <ul class="collapse">
<li><a href="#themes-data-frame" id="toc-themes-data-frame" class="nav-link" data-scroll-target="#themes-data-frame">Themes: Data Frame</a></li>
  </ul>
</li>
  <li><a href="#variable-labels" id="toc-variable-labels" class="nav-link" data-scroll-target="#variable-labels">Variable labels</a></li>
  <li>
<a href="#warning-saving-to-file" id="toc-warning-saving-to-file" class="nav-link" data-scroll-target="#warning-saving-to-file">Warning: Saving to file</a>
  <ul class="collapse">
<li><a href="#latex-significance-stars" id="toc-latex-significance-stars" class="nav-link" data-scroll-target="#latex-significance-stars">LaTeX significance stars</a></li>
  <li><a href="#math" id="toc-math" class="nav-link" data-scroll-target="#math">Math</a></li>
  </ul>
</li>
  </ul></nav>
    </div>
<!-- main -->
<main class="content" id="quarto-document-content"><header id="title-block-header" class="quarto-title-block default"><div class="quarto-title">
<h1 class="title">Themes and Styles</h1>
</div>



<div class="quarto-title-meta">

    
  
    
  </div>
  


</header><div class="cell">
<style type="text/css">
.table, th, td {
  font-size: 0.9em;
} 
.table tbody td, .table thead tr {
    white-space: nowrap;
}
</style>
</div>
<p>To customize the appearance of tables, <code>modelsummary</code> supports five of the most popular table-making packages:</p>
<ol type="1">
<li><a href="https://vincentarelbundock.github.io/tinytable/"><code>tinytable</code>: https://vincentarelbundock.github.io/tinytable/</a></li>
<li><a href="https://gt.rstudio.com"><code>gt</code>: https://gt.rstudio.com</a></li>
<li><a href="http://haozhu233.github.io/kableExtra"><code>kableExtra</code>: http://haozhu233.github.io/kableExtra</a></li>
<li><a href="https://hughjonesd.github.io/huxtable/"><code>huxtable</code>: https://hughjonesd.github.io/huxtable/</a></li>
<li><a href="https://davidgohel.github.io/flextable/"><code>flextable</code>: https://davidgohel.github.io/flextable/</a></li>
<li><a href="https://rstudio.github.io/DT"><code>DT</code>: https://rstudio.github.io/DT</a></li>
</ol>
<p>Users are encouraged to visit these websites to determine which package suits their needs best.</p>
<p>To create customized tables, we proceed as follows:</p>
<ol type="1">
<li>Call a <code>modelsummary</code> function like <code><a href="https://modelsummary.com/man/datasummary.html">datasummary()</a></code>.</li>
<li>Use the <code>output</code> argument to specify the package to be used for customization, such as <code>output="tinytable"</code> or <code>output="gt"</code>.</li>
<li>Apply a function from the package in question to the object created by <code>modelsummary</code>.</li>
</ol>
<p>To illustrate, we download data from the <a href="https://vincentarelbundock.github.io/Rdatasets'">Rdatasets repository</a> and we estimate 5 models:</p>
<div class="cell">
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://modelsummary.com">modelsummary</a></span><span class="op">)</span></span>
<span></span>
<span><span class="va">url</span> <span class="op">&lt;-</span> <span class="st">"https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv"</span></span>
<span><span class="va">dat</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/utils/read.table.html">read.csv</a></span><span class="op">(</span><span class="va">url</span>, na.strings <span class="op">=</span> <span class="st">""</span><span class="op">)</span></span>
<span></span>
<span><span class="va">models</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span></span>
<span>    I <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op">(</span><span class="va">Donations</span> <span class="op">~</span> <span class="va">Literacy</span>, data <span class="op">=</span> <span class="va">dat</span><span class="op">)</span>,</span>
<span>    II <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op">(</span><span class="va">Crime_pers</span> <span class="op">~</span> <span class="va">Literacy</span>, data <span class="op">=</span> <span class="va">dat</span><span class="op">)</span>,</span>
<span>    III <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op">(</span><span class="va">Crime_prop</span> <span class="op">~</span> <span class="va">Literacy</span> <span class="op">+</span> <span class="va">Clergy</span>, data <span class="op">=</span> <span class="va">dat</span><span class="op">)</span>,</span>
<span>    IV <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/stats/glm.html">glm</a></span><span class="op">(</span><span class="va">Crime_pers</span> <span class="op">~</span> <span class="va">Literacy</span> <span class="op">+</span> <span class="va">Clergy</span>, family <span class="op">=</span> <span class="va">poisson</span>, data <span class="op">=</span> <span class="va">dat</span><span class="op">)</span>,</span>
<span>    V <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/stats/glm.html">glm</a></span><span class="op">(</span><span class="va">Donations</span> <span class="op">~</span> <span class="va">Literacy</span> <span class="op">+</span> <span class="va">Clergy</span>, family <span class="op">=</span> <span class="va">poisson</span>, data <span class="op">=</span> <span class="va">dat</span><span class="op">)</span></span>
<span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>In the rest of this vignette, we will customize tables using tools <code>tinytable</code> and <code>gt</code>. The same process can be used to customize <code>kableExtra</code>, <code>flextable</code>, <code>huxtable</code>, and <code>DT</code> tables.</p>
<section id="tinytable" class="level1"><h1><code>tinytable</code></h1>
<p>The <code>tinytable</code> package offers many functions to customize the appearance of tables. Below, we give a couple illustrations, but interested readers should refer to the detailed tutorial on the <code>tinytable</code> package website: https://vincentarelbundock.github.io/tinytable/</p>
<p>In this example, we use the <code><a href="https://vincentarelbundock.github.io/tinytable/man/group_tt.html">group_tt()</a></code> function to add spanning column headers, and the <code><a href="https://vincentarelbundock.github.io/tinytable/man/style_tt.html">style_tt()</a></code> function to color a few cells of the table:</p>
<div class="cell">
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://vincentarelbundock.github.io/tinytable/">tinytable</a></span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">models</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span>    <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/group_tt.html">group_tt</a></span><span class="op">(</span>j <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>Linear <span class="op">=</span> <span class="fl">2</span><span class="op">:</span><span class="fl">4</span>, Poisson <span class="op">=</span> <span class="fl">5</span><span class="op">:</span><span class="fl">6</span><span class="op">)</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span>    <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/style_tt.html">style_tt</a></span><span class="op">(</span>i <span class="op">=</span> <span class="fl">3</span><span class="op">:</span><span class="fl">4</span>, j <span class="op">=</span> <span class="fl">2</span>, background <span class="op">=</span> <span class="st">"teal"</span>, color <span class="op">=</span> <span class="st">"white"</span>, bold <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<!-- preamble start -->

    <script>

      function styleCell_iznwvstd7dk2nr3zc0vf(i, j, css_id) {
          var table = document.getElementById("tinytable_iznwvstd7dk2nr3zc0vf");
          var cell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
          if (cell) {
              console.log(`Styling cell at (${i}, ${j}) with class ${css_id}`);
              cell.classList.add(css_id);
          } else {
              console.warn(`Cell at (${i}, ${j}) not found.`);
          }
      }
      function spanCell_iznwvstd7dk2nr3zc0vf(i, j, rowspan, colspan) {
        var table = document.getElementById("tinytable_iznwvstd7dk2nr3zc0vf");
        const targetCell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
        if (!targetCell) {
          console.warn(`Cell at (${i}, ${j}) not found.`);
        }

        // Get all cells that need to be removed
        const cellsToRemove = [];
        for (let r = 0; r < rowspan; r++) {
          for (let c = 0; c < colspan; c++) {
            if (r === 0 && c === 0) continue; // Skip the target cell
            const cell = table.querySelector(`[data-row="${i + r}"][data-col="${j + c}"]`);
            if (cell) {
              cellsToRemove.push(cell);
            }
          }
        }

        // Remove all cells
        cellsToRemove.forEach(cell => cell.remove());

        // Set rowspan and colspan of the target cell if it exists
        if (targetCell) {
          targetCell.rowSpan = rowspan;
          targetCell.colSpan = colspan;
        }
      }
      // tinytable span after
      window.addEventListener('load', function () {
          var cellsToStyle = [
            // tinytable style arrays after
          { positions: [ { i: '-1', j: 3 }, { i: '-1', j: 5 }, { i: '-1', j: 4 },  ], css_id: 'tinytable_css_31bpkc1kat4xo3scxx4m',}, 
          { positions: [ { i: '14', j: 1 }, { i: '14', j: 4 }, { i: '14', j: 2 }, { i: '14', j: 5 }, { i: '14', j: 3 },  ], css_id: 'tinytable_css_g2849irgnsb7anp3agf8',}, 
          { positions: [ { i: '6', j: 1 }, { i: '6', j: 5 }, { i: '6', j: 4 }, { i: '6', j: 2 }, { i: '6', j: 3 },  ], css_id: 'tinytable_css_p84pvxg2yrg4wib82max',}, 
          { positions: [ { i: '4', j: 1 }, { i: '3', j: 1 },  ], css_id: 'tinytable_css_wl2txu4nstx184753qsw',}, 
          { positions: [ { i: '1', j: 1 }, { i: '3', j: 2 }, { i: '1', j: 2 }, { i: '9', j: 1 }, { i: '10', j: 1 }, { i: '7', j: 1 }, { i: '12', j: 1 }, { i: '13', j: 1 }, { i: '11', j: 2 }, { i: '2', j: 1 }, { i: '13', j: 2 }, { i: '11', j: 3 }, { i: '5', j: 1 }, { i: '13', j: 3 }, { i: '4', j: 2 }, { i: '8', j: 1 }, { i: '3', j: 3 }, { i: '7', j: 2 }, { i: '11', j: 1 }, { i: '9', j: 2 }, { i: '10', j: 2 }, { i: '8', j: 3 }, { i: '12', j: 2 }, { i: '10', j: 3 }, { i: '8', j: 4 }, { i: '2', j: 2 }, { i: '10', j: 4 }, { i: '1', j: 3 }, { i: '5', j: 2 }, { i: '13', j: 4 }, { i: '4', j: 3 }, { i: '8', j: 2 }, { i: '3', j: 4 }, { i: '7', j: 3 }, { i: '5', j: 4 }, { i: '9', j: 3 }, { i: '7', j: 4 }, { i: '5', j: 5 }, { i: '12', j: 3 }, { i: '7', j: 5 }, { i: '11', j: 4 }, { i: '2', j: 3 }, { i: '10', j: 5 }, { i: '1', j: 4 }, { i: '5', j: 3 }, { i: '13', j: 5 }, { i: '4', j: 4 }, { i: '2', j: 5 }, { i: '3', j: 5 }, { i: '4', j: 5 }, { i: '12', j: 4 }, { i: '9', j: 4 }, { i: '11', j: 5 }, { i: '8', j: 5 }, { i: '12', j: 5 }, { i: '1', j: 5 }, { i: '2', j: 4 }, { i: '9', j: 5 },  ], css_id: 'tinytable_css_k2wc6g9x8gavsmlxoc0f',}, 
          { positions: [ { i: '-1', j: 1 }, { i: '-1', j: 2 },  ], css_id: 'tinytable_css_l4714rc1hz16yaluflml',}, 
          { positions: [ { i: '0', j: 1 }, { i: '0', j: 4 }, { i: '0', j: 3 }, { i: '0', j: 2 }, { i: '0', j: 5 },  ], css_id: 'tinytable_css_vii86wzto2i0b0rz1uwr',}, 
          { positions: [ { i: '14', j: 0 },  ], css_id: 'tinytable_css_tl9pmgol9dxwubjljqba',}, 
          { positions: [ { i: '6', j: 0 },  ], css_id: 'tinytable_css_rjg2ey4dkktgh03fqaqm',}, 
          { positions: [ { i: '1', j: 0 }, { i: '2', j: 0 }, { i: '3', j: 0 }, { i: '4', j: 0 }, { i: '5', j: 0 }, { i: '10', j: 0 }, { i: '7', j: 0 }, { i: '8', j: 0 }, { i: '9', j: 0 }, { i: '11', j: 0 }, { i: '12', j: 0 }, { i: '13', j: 0 },  ], css_id: 'tinytable_css_0gszqvrdhlc0yjpi34vz',}, 
          { positions: [ { i: '-1', j: 0 },  ], css_id: 'tinytable_css_yfs7sqep56vbxb3pk1ox',}, 
          { positions: [ { i: '0', j: 0 },  ], css_id: 'tinytable_css_5ky1q9it051bhh99a1sv',}, 
          ];

          // Loop over the arrays to style the cells
          cellsToStyle.forEach(function (group) {
              group.positions.forEach(function (cell) {
                  styleCell_iznwvstd7dk2nr3zc0vf(cell.i, cell.j, group.css_id);
              });
          });
      });
    </script><style>
      /* tinytable css entries after */
      .table td.tinytable_css_31bpkc1kat4xo3scxx4m, .table th.tinytable_css_31bpkc1kat4xo3scxx4m { text-align: center; border-top: solid #d3d8dc 0.1em; text-align: center; }
      .table td.tinytable_css_g2849irgnsb7anp3agf8, .table th.tinytable_css_g2849irgnsb7anp3agf8 { text-align: center; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_p84pvxg2yrg4wib82max, .table th.tinytable_css_p84pvxg2yrg4wib82max { text-align: center; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_wl2txu4nstx184753qsw, .table th.tinytable_css_wl2txu4nstx184753qsw { text-align: center; font-weight: bold; color: white; background-color: #008080; }
      .table td.tinytable_css_k2wc6g9x8gavsmlxoc0f, .table th.tinytable_css_k2wc6g9x8gavsmlxoc0f { text-align: center; }
      .table td.tinytable_css_l4714rc1hz16yaluflml, .table th.tinytable_css_l4714rc1hz16yaluflml { text-align: center; border-top: solid #d3d8dc 0.1em; text-align: center; border-bottom: solid #d3d8dc 0.05em; }
      .table td.tinytable_css_vii86wzto2i0b0rz1uwr, .table th.tinytable_css_vii86wzto2i0b0rz1uwr { text-align: center; border-bottom: solid #d3d8dc 0.05em; }
      .table td.tinytable_css_tl9pmgol9dxwubjljqba, .table th.tinytable_css_tl9pmgol9dxwubjljqba { text-align: left; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_rjg2ey4dkktgh03fqaqm, .table th.tinytable_css_rjg2ey4dkktgh03fqaqm { text-align: left; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_0gszqvrdhlc0yjpi34vz, .table th.tinytable_css_0gszqvrdhlc0yjpi34vz { text-align: left; }
      .table td.tinytable_css_yfs7sqep56vbxb3pk1ox, .table th.tinytable_css_yfs7sqep56vbxb3pk1ox { text-align: left; border-top: solid #d3d8dc 0.1em; text-align: center; }
      .table td.tinytable_css_5ky1q9it051bhh99a1sv, .table th.tinytable_css_5ky1q9it051bhh99a1sv { text-align: left; border-bottom: solid #d3d8dc 0.05em; }
    </style>
<div class="container">
      <table class="table table-borderless" id="tinytable_iznwvstd7dk2nr3zc0vf" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing="true">
<thead>
<tr>
<th scope="col" align="center" colspan="1" data-row="-1" data-col="0"> </th>
<th scope="col" align="center" colspan="3" data-row="-1" data-col="1">Linear</th>
<th scope="col" align="center" colspan="2" data-row="-1" data-col="2">Poisson</th>
</tr>
<tr>
<th scope="col" data-row="0" data-col="0"> </th>
                <th scope="col" data-row="0" data-col="1">I</th>
                <th scope="col" data-row="0" data-col="2">II</th>
                <th scope="col" data-row="0" data-col="3">III</th>
                <th scope="col" data-row="0" data-col="4">IV</th>
                <th scope="col" data-row="0" data-col="5">V</th>
              </tr>
</thead>
<tbody>
<tr>
<td data-row="1" data-col="0">(Intercept)</td>
                  <td data-row="1" data-col="1">8759.068</td>
                  <td data-row="1" data-col="2">20357.309</td>
                  <td data-row="1" data-col="3">11243.544</td>
                  <td data-row="1" data-col="4">9.708</td>
                  <td data-row="1" data-col="5">8.986</td>
                </tr>
<tr>
<td data-row="2" data-col="0"></td>
                  <td data-row="2" data-col="1">(1559.363)</td>
                  <td data-row="2" data-col="2">(2020.980)</td>
                  <td data-row="2" data-col="3">(1011.240)</td>
                  <td data-row="2" data-col="4">(0.003)</td>
                  <td data-row="2" data-col="5">(0.004)</td>
                </tr>
<tr>
<td data-row="3" data-col="0">Literacy</td>
                  <td data-row="3" data-col="1">-42.886</td>
                  <td data-row="3" data-col="2">-15.358</td>
                  <td data-row="3" data-col="3">-68.507</td>
                  <td data-row="3" data-col="4">0.000</td>
                  <td data-row="3" data-col="5">-0.006</td>
                </tr>
<tr>
<td data-row="4" data-col="0"></td>
                  <td data-row="4" data-col="1">(36.362)</td>
                  <td data-row="4" data-col="2">(47.127)</td>
                  <td data-row="4" data-col="3">(18.029)</td>
                  <td data-row="4" data-col="4">(0.000)</td>
                  <td data-row="4" data-col="5">(0.000)</td>
                </tr>
<tr>
<td data-row="5" data-col="0">Clergy</td>
                  <td data-row="5" data-col="1"></td>
                  <td data-row="5" data-col="2"></td>
                  <td data-row="5" data-col="3">-16.376</td>
                  <td data-row="5" data-col="4">0.004</td>
                  <td data-row="5" data-col="5">0.002</td>
                </tr>
<tr>
<td data-row="6" data-col="0"></td>
                  <td data-row="6" data-col="1"></td>
                  <td data-row="6" data-col="2"></td>
                  <td data-row="6" data-col="3">(12.522)</td>
                  <td data-row="6" data-col="4">(0.000)</td>
                  <td data-row="6" data-col="5">(0.000)</td>
                </tr>
<tr>
<td data-row="7" data-col="0">Num.Obs.</td>
                  <td data-row="7" data-col="1">86</td>
                  <td data-row="7" data-col="2">86</td>
                  <td data-row="7" data-col="3">86</td>
                  <td data-row="7" data-col="4">86</td>
                  <td data-row="7" data-col="5">86</td>
                </tr>
<tr>
<td data-row="8" data-col="0">R2</td>
                  <td data-row="8" data-col="1">0.016</td>
                  <td data-row="8" data-col="2">0.001</td>
                  <td data-row="8" data-col="3">0.152</td>
                  <td data-row="8" data-col="4"></td>
                  <td data-row="8" data-col="5"></td>
                </tr>
<tr>
<td data-row="9" data-col="0">R2 Adj.</td>
                  <td data-row="9" data-col="1">0.005</td>
                  <td data-row="9" data-col="2">-0.011</td>
                  <td data-row="9" data-col="3">0.132</td>
                  <td data-row="9" data-col="4"></td>
                  <td data-row="9" data-col="5"></td>
                </tr>
<tr>
<td data-row="10" data-col="0">AIC</td>
                  <td data-row="10" data-col="1">1739.1</td>
                  <td data-row="10" data-col="2">1783.7</td>
                  <td data-row="10" data-col="3">1616.9</td>
                  <td data-row="10" data-col="4">242266.3</td>
                  <td data-row="10" data-col="5">302865.8</td>
                </tr>
<tr>
<td data-row="11" data-col="0">BIC</td>
                  <td data-row="11" data-col="1">1746.5</td>
                  <td data-row="11" data-col="2">1791.1</td>
                  <td data-row="11" data-col="3">1626.7</td>
                  <td data-row="11" data-col="4">242273.6</td>
                  <td data-row="11" data-col="5">302873.2</td>
                </tr>
<tr>
<td data-row="12" data-col="0">Log.Lik.</td>
                  <td data-row="12" data-col="1">-866.574</td>
                  <td data-row="12" data-col="2">-888.874</td>
                  <td data-row="12" data-col="3">-804.441</td>
                  <td data-row="12" data-col="4">-121130.130</td>
                  <td data-row="12" data-col="5">-151429.921</td>
                </tr>
<tr>
<td data-row="13" data-col="0">F</td>
                  <td data-row="13" data-col="1">1.391</td>
                  <td data-row="13" data-col="2">0.106</td>
                  <td data-row="13" data-col="3">7.441</td>
                  <td data-row="13" data-col="4">7905.811</td>
                  <td data-row="13" data-col="5">4170.610</td>
                </tr>
<tr>
<td data-row="14" data-col="0">RMSE</td>
                  <td data-row="14" data-col="1">5753.14</td>
                  <td data-row="14" data-col="2">7456.23</td>
                  <td data-row="14" data-col="3">2793.43</td>
                  <td data-row="14" data-col="4">7233.22</td>
                  <td data-row="14" data-col="5">5727.27</td>
                </tr>
</tbody>
</table>
</div>
<!-- hack to avoid NA insertion in last line -->
</div>
</div>
<p>Now, we create a descriptive statistics table with <code><a href="https://modelsummary.com/man/datasummary.html">datasummary()</a></code>. That table includes an emptyr row, which we fill with density plots using the <code><a href="https://vincentarelbundock.github.io/tinytable/man/plot_tt.html">plot_tt()</a></code> function from <code>tinytable</code>:</p>
<div class="cell">
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va">Density</span> <span class="op">&lt;-</span> <span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="st">""</span></span>
<span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/datasummary.html">datasummary</a></span><span class="op">(</span><span class="va">mpg</span> <span class="op">+</span> <span class="va">hp</span> <span class="op">~</span> <span class="va">Mean</span> <span class="op">+</span> <span class="va">SD</span> <span class="op">+</span> <span class="va">Density</span>, data <span class="op">=</span> <span class="va">mtcars</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span>    <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/plot_tt.html">plot_tt</a></span><span class="op">(</span></span>
<span>        j <span class="op">=</span> <span class="fl">4</span>,</span>
<span>        fun <span class="op">=</span> <span class="st">"density"</span>,</span>
<span>        data <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span><span class="va">mtcars</span><span class="op">$</span><span class="va">mpg</span>, <span class="va">mtcars</span><span class="op">$</span><span class="va">hp</span><span class="op">)</span>,</span>
<span>        color <span class="op">=</span> <span class="st">"#E69F00"</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<!-- preamble start -->

    <script>

      function styleCell_uh21k1zfnoyae4qnk7xa(i, j, css_id) {
          var table = document.getElementById("tinytable_uh21k1zfnoyae4qnk7xa");
          var cell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
          if (cell) {
              console.log(`Styling cell at (${i}, ${j}) with class ${css_id}`);
              cell.classList.add(css_id);
          } else {
              console.warn(`Cell at (${i}, ${j}) not found.`);
          }
      }
      function spanCell_uh21k1zfnoyae4qnk7xa(i, j, rowspan, colspan) {
        var table = document.getElementById("tinytable_uh21k1zfnoyae4qnk7xa");
        const targetCell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
        if (!targetCell) {
          console.warn(`Cell at (${i}, ${j}) not found.`);
        }

        // Get all cells that need to be removed
        const cellsToRemove = [];
        for (let r = 0; r < rowspan; r++) {
          for (let c = 0; c < colspan; c++) {
            if (r === 0 && c === 0) continue; // Skip the target cell
            const cell = table.querySelector(`[data-row="${i + r}"][data-col="${j + c}"]`);
            if (cell) {
              cellsToRemove.push(cell);
            }
          }
        }

        // Remove all cells
        cellsToRemove.forEach(cell => cell.remove());

        // Set rowspan and colspan of the target cell if it exists
        if (targetCell) {
          targetCell.rowSpan = rowspan;
          targetCell.colSpan = colspan;
        }
      }
      // tinytable span after
      window.addEventListener('load', function () {
          var cellsToStyle = [
            // tinytable style arrays after
          { positions: [ { i: '2', j: 2 }, { i: '2', j: 1 }, { i: '2', j: 3 },  ], css_id: 'tinytable_css_210autypggvc14fyad3j',}, 
          { positions: [ { i: '1', j: 1 }, { i: '1', j: 2 }, { i: '1', j: 3 },  ], css_id: 'tinytable_css_3yyggv7uo0fvtle0uek0',}, 
          { positions: [ { i: '0', j: 1 }, { i: '0', j: 3 }, { i: '0', j: 2 },  ], css_id: 'tinytable_css_y4y7i7vlzm87oqyqqvq2',}, 
          { positions: [ { i: '2', j: 0 },  ], css_id: 'tinytable_css_s8qu7un3dio45wb0ufmg',}, 
          { positions: [ { i: '1', j: 0 },  ], css_id: 'tinytable_css_z3y4mcvss8ifxbh3m7yo',}, 
          { positions: [ { i: '0', j: 0 },  ], css_id: 'tinytable_css_9y62ms0moz9q8x0zdjnr',}, 
          ];

          // Loop over the arrays to style the cells
          cellsToStyle.forEach(function (group) {
              group.positions.forEach(function (cell) {
                  styleCell_uh21k1zfnoyae4qnk7xa(cell.i, cell.j, group.css_id);
              });
          });
      });
    </script><style>
      /* tinytable css entries after */
      .table td.tinytable_css_210autypggvc14fyad3j, .table th.tinytable_css_210autypggvc14fyad3j { text-align: right; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_3yyggv7uo0fvtle0uek0, .table th.tinytable_css_3yyggv7uo0fvtle0uek0 { text-align: right; }
      .table td.tinytable_css_y4y7i7vlzm87oqyqqvq2, .table th.tinytable_css_y4y7i7vlzm87oqyqqvq2 { text-align: right; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
      .table td.tinytable_css_s8qu7un3dio45wb0ufmg, .table th.tinytable_css_s8qu7un3dio45wb0ufmg { text-align: left; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_z3y4mcvss8ifxbh3m7yo, .table th.tinytable_css_z3y4mcvss8ifxbh3m7yo { text-align: left; }
      .table td.tinytable_css_9y62ms0moz9q8x0zdjnr, .table th.tinytable_css_9y62ms0moz9q8x0zdjnr { text-align: left; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
    </style>
<div class="container">
      <table class="table table-borderless" id="tinytable_uh21k1zfnoyae4qnk7xa" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing="true">
<thead><tr>
<th scope="col" data-row="0" data-col="0"> </th>
                <th scope="col" data-row="0" data-col="1">Mean</th>
                <th scope="col" data-row="0" data-col="2">SD</th>
                <th scope="col" data-row="0" data-col="3">Density</th>
              </tr></thead>
<tbody>
<tr>
<td data-row="1" data-col="0">mpg</td>
                  <td data-row="1" data-col="1">20.09</td>
                  <td data-row="1" data-col="2">6.03</td>
                  <td data-row="1" data-col="3"><img src="./tinytable_assets/idguj7qhr5cvk5437rolbn.png" style="height: 1em;"></td>
                </tr>
<tr>
<td data-row="2" data-col="0">hp</td>
                  <td data-row="2" data-col="1">146.69</td>
                  <td data-row="2" data-col="2">68.56</td>
                  <td data-row="2" data-col="3"><img src="./tinytable_assets/id0st4qs28ni44cz4twhmd.png" style="height: 1em;"></td>
                </tr>
</tbody>
</table>
</div>
<!-- hack to avoid NA insertion in last line -->
</div>
</div>
<p>HTML tables can be further customized in <code>tinytable</code> by specifying CSS rules. Again, <a href="https://vincentarelbundock.github.io/tinytable/">detailed tutorials are available on the <code>tinytable</code> website.</a> This example adds an image in the background of a table:</p>
<div class="cell">
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va">css</span> <span class="op">&lt;-</span> <span class="st">"</span></span>
<span><span class="st">.mytable {</span></span>
<span><span class="st">  background-size: cover;</span></span>
<span><span class="st">  background-position: center;</span></span>
<span><span class="st">  background-image: url('https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png');</span></span>
<span><span class="st">  --bs-table-bg: transparent;</span></span>
<span><span class="st">}</span></span>
<span><span class="st">"</span></span>
<span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">models</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span>    <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/style_tt.html">style_tt</a></span><span class="op">(</span></span>
<span>        bootstrap_class <span class="op">=</span> <span class="st">"table table-borderless mytable"</span>, </span>
<span>        bootstrap_css_rule <span class="op">=</span> <span class="va">css</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: The `bootstrap_class` argument is deprecated. Use `theme_html(x, class = ...)` instead.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: The `bootstrap_css_rule` argument is deprecated. Use `theme_html(x, css_rule = ...)` instead.</code></pre>
</div>
<div class="cell-output-display">
<!-- preamble start -->

    <script>

      function styleCell_n8hvbhl12cqd4okdtazi(i, j, css_id) {
          var table = document.getElementById("tinytable_n8hvbhl12cqd4okdtazi");
          var cell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
          if (cell) {
              console.log(`Styling cell at (${i}, ${j}) with class ${css_id}`);
              cell.classList.add(css_id);
          } else {
              console.warn(`Cell at (${i}, ${j}) not found.`);
          }
      }
      function spanCell_n8hvbhl12cqd4okdtazi(i, j, rowspan, colspan) {
        var table = document.getElementById("tinytable_n8hvbhl12cqd4okdtazi");
        const targetCell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
        if (!targetCell) {
          console.warn(`Cell at (${i}, ${j}) not found.`);
        }

        // Get all cells that need to be removed
        const cellsToRemove = [];
        for (let r = 0; r < rowspan; r++) {
          for (let c = 0; c < colspan; c++) {
            if (r === 0 && c === 0) continue; // Skip the target cell
            const cell = table.querySelector(`[data-row="${i + r}"][data-col="${j + c}"]`);
            if (cell) {
              cellsToRemove.push(cell);
            }
          }
        }

        // Remove all cells
        cellsToRemove.forEach(cell => cell.remove());

        // Set rowspan and colspan of the target cell if it exists
        if (targetCell) {
          targetCell.rowSpan = rowspan;
          targetCell.colSpan = colspan;
        }
      }
      // tinytable span after
      window.addEventListener('load', function () {
          var cellsToStyle = [
            // tinytable style arrays after
          { positions: [ { i: '14', j: 1 }, { i: '14', j: 2 }, { i: '14', j: 3 }, { i: '14', j: 4 }, { i: '14', j: 5 },  ], css_id: 'tinytable_css_qcax3pqn93zm4jqejs88',}, 
          { positions: [ { i: '6', j: 3 }, { i: '6', j: 4 }, { i: '6', j: 5 }, { i: '6', j: 1 }, { i: '6', j: 2 },  ], css_id: 'tinytable_css_favvm4yj4qvdblsieq2n',}, 
          { positions: [ { i: '1', j: 1 }, { i: '3', j: 1 }, { i: '5', j: 1 }, { i: '7', j: 1 }, { i: '9', j: 1 }, { i: '10', j: 1 }, { i: '11', j: 1 }, { i: '12', j: 1 }, { i: '13', j: 1 }, { i: '12', j: 2 }, { i: '2', j: 1 }, { i: '1', j: 2 }, { i: '4', j: 1 }, { i: '3', j: 2 }, { i: '4', j: 2 }, { i: '5', j: 2 }, { i: '8', j: 1 }, { i: '7', j: 2 }, { i: '8', j: 2 }, { i: '9', j: 2 }, { i: '10', j: 2 }, { i: '11', j: 2 }, { i: '10', j: 3 }, { i: '13', j: 2 }, { i: '12', j: 3 }, { i: '2', j: 2 }, { i: '1', j: 3 }, { i: '2', j: 3 }, { i: '3', j: 3 }, { i: '4', j: 3 }, { i: '5', j: 3 }, { i: '4', j: 4 }, { i: '7', j: 3 }, { i: '8', j: 3 }, { i: '9', j: 3 }, { i: '8', j: 4 }, { i: '11', j: 3 }, { i: '10', j: 4 }, { i: '13', j: 3 }, { i: '12', j: 4 }, { i: '13', j: 4 }, { i: '1', j: 4 }, { i: '2', j: 4 }, { i: '3', j: 4 }, { i: '2', j: 5 }, { i: '5', j: 4 }, { i: '4', j: 5 }, { i: '7', j: 4 }, { i: '10', j: 5 }, { i: '9', j: 4 }, { i: '8', j: 5 }, { i: '11', j: 4 }, { i: '1', j: 5 }, { i: '11', j: 5 }, { i: '12', j: 5 }, { i: '13', j: 5 }, { i: '5', j: 5 }, { i: '3', j: 5 }, { i: '9', j: 5 }, { i: '7', j: 5 },  ], css_id: 'tinytable_css_wyi2m9uizm910d5xjm0u',}, 
          { positions: [ { i: '0', j: 1 }, { i: '0', j: 2 }, { i: '0', j: 3 }, { i: '0', j: 4 }, { i: '0', j: 5 },  ], css_id: 'tinytable_css_qr7c2l1xhd2oeg8bch5f',}, 
          { positions: [ { i: '14', j: 0 },  ], css_id: 'tinytable_css_nf6m66bmz6x69u6j3ofy',}, 
          { positions: [ { i: '6', j: 0 },  ], css_id: 'tinytable_css_m54ej06rmrhvn1vkfbit',}, 
          { positions: [ { i: '1', j: 0 }, { i: '2', j: 0 }, { i: '3', j: 0 }, { i: '4', j: 0 }, { i: '5', j: 0 }, { i: '10', j: 0 }, { i: '7', j: 0 }, { i: '8', j: 0 }, { i: '9', j: 0 }, { i: '11', j: 0 }, { i: '12', j: 0 }, { i: '13', j: 0 },  ], css_id: 'tinytable_css_llo9nw78hax5cjqhlv9j',}, 
          { positions: [ { i: '0', j: 0 },  ], css_id: 'tinytable_css_dxxugay5akdxdc7gnyxo',}, 
          ];

          // Loop over the arrays to style the cells
          cellsToStyle.forEach(function (group) {
              group.positions.forEach(function (cell) {
                  styleCell_n8hvbhl12cqd4okdtazi(cell.i, cell.j, group.css_id);
              });
          });
      });
    </script><style>
      /* tinytable css entries after */
      .table td.tinytable_css_qcax3pqn93zm4jqejs88, .table th.tinytable_css_qcax3pqn93zm4jqejs88 { text-align: center; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_favvm4yj4qvdblsieq2n, .table th.tinytable_css_favvm4yj4qvdblsieq2n { text-align: center; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_wyi2m9uizm910d5xjm0u, .table th.tinytable_css_wyi2m9uizm910d5xjm0u { text-align: center; }
      .table td.tinytable_css_qr7c2l1xhd2oeg8bch5f, .table th.tinytable_css_qr7c2l1xhd2oeg8bch5f { text-align: center; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
      .table td.tinytable_css_nf6m66bmz6x69u6j3ofy, .table th.tinytable_css_nf6m66bmz6x69u6j3ofy { text-align: left; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_m54ej06rmrhvn1vkfbit, .table th.tinytable_css_m54ej06rmrhvn1vkfbit { text-align: left; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_llo9nw78hax5cjqhlv9j, .table th.tinytable_css_llo9nw78hax5cjqhlv9j { text-align: left; }
      .table td.tinytable_css_dxxugay5akdxdc7gnyxo, .table th.tinytable_css_dxxugay5akdxdc7gnyxo { text-align: left; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
    </style>
<div class="container">
      <table class="table table-borderless" id="tinytable_n8hvbhl12cqd4okdtazi" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing="true">
<thead><tr>
<th scope="col" data-row="0" data-col="0"> </th>
                <th scope="col" data-row="0" data-col="1">I</th>
                <th scope="col" data-row="0" data-col="2">II</th>
                <th scope="col" data-row="0" data-col="3">III</th>
                <th scope="col" data-row="0" data-col="4">IV</th>
                <th scope="col" data-row="0" data-col="5">V</th>
              </tr></thead>
<tbody>
<tr>
<td data-row="1" data-col="0">(Intercept)</td>
                  <td data-row="1" data-col="1">8759.068</td>
                  <td data-row="1" data-col="2">20357.309</td>
                  <td data-row="1" data-col="3">11243.544</td>
                  <td data-row="1" data-col="4">9.708</td>
                  <td data-row="1" data-col="5">8.986</td>
                </tr>
<tr>
<td data-row="2" data-col="0"></td>
                  <td data-row="2" data-col="1">(1559.363)</td>
                  <td data-row="2" data-col="2">(2020.980)</td>
                  <td data-row="2" data-col="3">(1011.240)</td>
                  <td data-row="2" data-col="4">(0.003)</td>
                  <td data-row="2" data-col="5">(0.004)</td>
                </tr>
<tr>
<td data-row="3" data-col="0">Literacy</td>
                  <td data-row="3" data-col="1">-42.886</td>
                  <td data-row="3" data-col="2">-15.358</td>
                  <td data-row="3" data-col="3">-68.507</td>
                  <td data-row="3" data-col="4">0.000</td>
                  <td data-row="3" data-col="5">-0.006</td>
                </tr>
<tr>
<td data-row="4" data-col="0"></td>
                  <td data-row="4" data-col="1">(36.362)</td>
                  <td data-row="4" data-col="2">(47.127)</td>
                  <td data-row="4" data-col="3">(18.029)</td>
                  <td data-row="4" data-col="4">(0.000)</td>
                  <td data-row="4" data-col="5">(0.000)</td>
                </tr>
<tr>
<td data-row="5" data-col="0">Clergy</td>
                  <td data-row="5" data-col="1"></td>
                  <td data-row="5" data-col="2"></td>
                  <td data-row="5" data-col="3">-16.376</td>
                  <td data-row="5" data-col="4">0.004</td>
                  <td data-row="5" data-col="5">0.002</td>
                </tr>
<tr>
<td data-row="6" data-col="0"></td>
                  <td data-row="6" data-col="1"></td>
                  <td data-row="6" data-col="2"></td>
                  <td data-row="6" data-col="3">(12.522)</td>
                  <td data-row="6" data-col="4">(0.000)</td>
                  <td data-row="6" data-col="5">(0.000)</td>
                </tr>
<tr>
<td data-row="7" data-col="0">Num.Obs.</td>
                  <td data-row="7" data-col="1">86</td>
                  <td data-row="7" data-col="2">86</td>
                  <td data-row="7" data-col="3">86</td>
                  <td data-row="7" data-col="4">86</td>
                  <td data-row="7" data-col="5">86</td>
                </tr>
<tr>
<td data-row="8" data-col="0">R2</td>
                  <td data-row="8" data-col="1">0.016</td>
                  <td data-row="8" data-col="2">0.001</td>
                  <td data-row="8" data-col="3">0.152</td>
                  <td data-row="8" data-col="4"></td>
                  <td data-row="8" data-col="5"></td>
                </tr>
<tr>
<td data-row="9" data-col="0">R2 Adj.</td>
                  <td data-row="9" data-col="1">0.005</td>
                  <td data-row="9" data-col="2">-0.011</td>
                  <td data-row="9" data-col="3">0.132</td>
                  <td data-row="9" data-col="4"></td>
                  <td data-row="9" data-col="5"></td>
                </tr>
<tr>
<td data-row="10" data-col="0">AIC</td>
                  <td data-row="10" data-col="1">1739.1</td>
                  <td data-row="10" data-col="2">1783.7</td>
                  <td data-row="10" data-col="3">1616.9</td>
                  <td data-row="10" data-col="4">242266.3</td>
                  <td data-row="10" data-col="5">302865.8</td>
                </tr>
<tr>
<td data-row="11" data-col="0">BIC</td>
                  <td data-row="11" data-col="1">1746.5</td>
                  <td data-row="11" data-col="2">1791.1</td>
                  <td data-row="11" data-col="3">1626.7</td>
                  <td data-row="11" data-col="4">242273.6</td>
                  <td data-row="11" data-col="5">302873.2</td>
                </tr>
<tr>
<td data-row="12" data-col="0">Log.Lik.</td>
                  <td data-row="12" data-col="1">-866.574</td>
                  <td data-row="12" data-col="2">-888.874</td>
                  <td data-row="12" data-col="3">-804.441</td>
                  <td data-row="12" data-col="4">-121130.130</td>
                  <td data-row="12" data-col="5">-151429.921</td>
                </tr>
<tr>
<td data-row="13" data-col="0">F</td>
                  <td data-row="13" data-col="1">1.391</td>
                  <td data-row="13" data-col="2">0.106</td>
                  <td data-row="13" data-col="3">7.441</td>
                  <td data-row="13" data-col="4">7905.811</td>
                  <td data-row="13" data-col="5">4170.610</td>
                </tr>
<tr>
<td data-row="14" data-col="0">RMSE</td>
                  <td data-row="14" data-col="1">5753.14</td>
                  <td data-row="14" data-col="2">7456.23</td>
                  <td data-row="14" data-col="3">2793.43</td>
                  <td data-row="14" data-col="4">7233.22</td>
                  <td data-row="14" data-col="5">5727.27</td>
                </tr>
</tbody>
</table>
</div>
<!-- hack to avoid NA insertion in last line -->
</div>
</div>
<section id="dot-alignement-in-latex" class="level2"><h2 class="anchored" data-anchor-id="dot-alignement-in-latex">Dot alignement in LaTeX</h2>
<p>Sometimes, dot-alignment fails in LaTeX because some cells include only text. In other cases, users wish to prevent dot-alignment for specific cells. This can be achieved by using the <code><a href="https://vincentarelbundock.github.io/tinytable/man/style_tt.html">tinytable::style_tt()</a></code> function to insert <code>tabularray</code> instructions in to the raw LaTeX table. Here, we create a regression table for a <code>fixest</code> model. The output includes a text-only row which identifies fixed effects. We call <code><a href="https://vincentarelbundock.github.io/tinytable/man/style_tt.html">style_tt()</a></code> to “guard” and center the text in the relevant cells.</p>
<div class="cell">
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://lrberge.github.io/fixest/">fixest</a></span><span class="op">)</span></span>
<span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://vincentarelbundock.github.io/tinytable/">tinytable</a></span><span class="op">)</span></span>
<span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://modelsummary.com">modelsummary</a></span><span class="op">)</span></span>
<span><span class="va">m</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://lrberge.github.io/fixest/reference/feols.html">feols</a></span><span class="op">(</span><span class="va">mpg</span> <span class="op">~</span> <span class="va">wt</span> <span class="op">+</span> <span class="fu"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op">(</span><span class="va">cyl</span><span class="op">)</span> <span class="op">|</span> <span class="va">carb</span>, data <span class="op">=</span> <span class="va">mtcars</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">m</span>, align <span class="op">=</span> <span class="st">"ld"</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span>  <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/theme_latex.html">theme_latex</a></span><span class="op">(</span>tabularray_inner <span class="op">=</span> <span class="st">"cell{16-17}{2}={guard,halign=c}"</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<!-- preamble start -->

    <script>

      function styleCell_4gkhjoopkd63n99fp5ov(i, j, css_id) {
          var table = document.getElementById("tinytable_4gkhjoopkd63n99fp5ov");
          var cell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
          if (cell) {
              console.log(`Styling cell at (${i}, ${j}) with class ${css_id}`);
              cell.classList.add(css_id);
          } else {
              console.warn(`Cell at (${i}, ${j}) not found.`);
          }
      }
      function spanCell_4gkhjoopkd63n99fp5ov(i, j, rowspan, colspan) {
        var table = document.getElementById("tinytable_4gkhjoopkd63n99fp5ov");
        const targetCell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
        if (!targetCell) {
          console.warn(`Cell at (${i}, ${j}) not found.`);
        }

        // Get all cells that need to be removed
        const cellsToRemove = [];
        for (let r = 0; r < rowspan; r++) {
          for (let c = 0; c < colspan; c++) {
            if (r === 0 && c === 0) continue; // Skip the target cell
            const cell = table.querySelector(`[data-row="${i + r}"][data-col="${j + c}"]`);
            if (cell) {
              cellsToRemove.push(cell);
            }
          }
        }

        // Remove all cells
        cellsToRemove.forEach(cell => cell.remove());

        // Set rowspan and colspan of the target cell if it exists
        if (targetCell) {
          targetCell.rowSpan = rowspan;
          targetCell.colSpan = colspan;
        }
      }
      // tinytable span after
      window.addEventListener('load', function () {
          var cellsToStyle = [
            // tinytable style arrays after
          { positions: [ { i: '16', j: 1 },  ], css_id: 'tinytable_css_h16a58dejswb9t1ssz2p',}, 
          { positions: [ { i: '6', j: 1 },  ], css_id: 'tinytable_css_fdi1958vdbxp5qmuacmp',}, 
          { positions: [ { i: '1', j: 1 }, { i: '2', j: 1 }, { i: '3', j: 1 }, { i: '4', j: 1 }, { i: '5', j: 1 }, { i: '10', j: 1 }, { i: '7', j: 1 }, { i: '8', j: 1 }, { i: '9', j: 1 }, { i: '14', j: 1 }, { i: '11', j: 1 }, { i: '12', j: 1 }, { i: '13', j: 1 }, { i: '15', j: 1 },  ], css_id: 'tinytable_css_6romjne7jgd68696pwsv',}, 
          { positions: [ { i: '0', j: 1 },  ], css_id: 'tinytable_css_5o7bxqgpvy9ytr8o7a7l',}, 
          { positions: [ { i: '16', j: 0 },  ], css_id: 'tinytable_css_60wv3g7okhmyoq3euzu0',}, 
          { positions: [ { i: '6', j: 0 },  ], css_id: 'tinytable_css_8rkvnde6m47sz5hinha4',}, 
          { positions: [ { i: '1', j: 0 }, { i: '2', j: 0 }, { i: '3', j: 0 }, { i: '4', j: 0 }, { i: '5', j: 0 }, { i: '10', j: 0 }, { i: '7', j: 0 }, { i: '8', j: 0 }, { i: '9', j: 0 }, { i: '14', j: 0 }, { i: '11', j: 0 }, { i: '12', j: 0 }, { i: '13', j: 0 }, { i: '15', j: 0 },  ], css_id: 'tinytable_css_c64eolbxrqtti8aqaojp',}, 
          { positions: [ { i: '0', j: 0 },  ], css_id: 'tinytable_css_leedr8l8h0c3g6qy8i0p',}, 
          ];

          // Loop over the arrays to style the cells
          cellsToStyle.forEach(function (group) {
              group.positions.forEach(function (cell) {
                  styleCell_4gkhjoopkd63n99fp5ov(cell.i, cell.j, group.css_id);
              });
          });
      });
    </script><style>
      /* tinytable css entries after */
      .table td.tinytable_css_h16a58dejswb9t1ssz2p, .table th.tinytable_css_h16a58dejswb9t1ssz2p { text-align: center; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_fdi1958vdbxp5qmuacmp, .table th.tinytable_css_fdi1958vdbxp5qmuacmp { text-align: center; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_6romjne7jgd68696pwsv, .table th.tinytable_css_6romjne7jgd68696pwsv { text-align: center; }
      .table td.tinytable_css_5o7bxqgpvy9ytr8o7a7l, .table th.tinytable_css_5o7bxqgpvy9ytr8o7a7l { text-align: center; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
      .table td.tinytable_css_60wv3g7okhmyoq3euzu0, .table th.tinytable_css_60wv3g7okhmyoq3euzu0 { text-align: left; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_8rkvnde6m47sz5hinha4, .table th.tinytable_css_8rkvnde6m47sz5hinha4 { text-align: left; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_c64eolbxrqtti8aqaojp, .table th.tinytable_css_c64eolbxrqtti8aqaojp { text-align: left; }
      .table td.tinytable_css_leedr8l8h0c3g6qy8i0p, .table th.tinytable_css_leedr8l8h0c3g6qy8i0p { text-align: left; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
    </style>
<div class="container">
      <table class="table table-borderless" id="tinytable_4gkhjoopkd63n99fp5ov" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing="true">
<thead><tr>
<th scope="col" data-row="0" data-col="0"> </th>
                <th scope="col" data-row="0" data-col="1">(1)</th>
              </tr></thead>
<tbody>
<tr>
<td data-row="1" data-col="0">wt</td>
                  <td data-row="1" data-col="1">-3.110</td>
                </tr>
<tr>
<td data-row="2" data-col="0"></td>
                  <td data-row="2" data-col="1">(1.068)</td>
                </tr>
<tr>
<td data-row="3" data-col="0">factor(cyl)6</td>
                  <td data-row="3" data-col="1">-3.484</td>
                </tr>
<tr>
<td data-row="4" data-col="0"></td>
                  <td data-row="4" data-col="1">(0.520)</td>
                </tr>
<tr>
<td data-row="5" data-col="0">factor(cyl)8</td>
                  <td data-row="5" data-col="1">-5.528</td>
                </tr>
<tr>
<td data-row="6" data-col="0"></td>
                  <td data-row="6" data-col="1">(1.797)</td>
                </tr>
<tr>
<td data-row="7" data-col="0">Num.Obs.</td>
                  <td data-row="7" data-col="1">32</td>
                </tr>
<tr>
<td data-row="8" data-col="0">R2</td>
                  <td data-row="8" data-col="1">0.847</td>
                </tr>
<tr>
<td data-row="9" data-col="0">R2 Adj.</td>
                  <td data-row="9" data-col="1">0.794</td>
                </tr>
<tr>
<td data-row="10" data-col="0">R2 Within</td>
                  <td data-row="10" data-col="1">0.725</td>
                </tr>
<tr>
<td data-row="11" data-col="0">R2 Within Adj.</td>
                  <td data-row="11" data-col="1">0.689</td>
                </tr>
<tr>
<td data-row="12" data-col="0">AIC</td>
                  <td data-row="12" data-col="1">162.7</td>
                </tr>
<tr>
<td data-row="13" data-col="0">BIC</td>
                  <td data-row="13" data-col="1">175.8</td>
                </tr>
<tr>
<td data-row="14" data-col="0">RMSE</td>
                  <td data-row="14" data-col="1">2.32</td>
                </tr>
<tr>
<td data-row="15" data-col="0">Std.Errors</td>
                  <td data-row="15" data-col="1">by: carb</td>
                </tr>
<tr>
<td data-row="16" data-col="0">FE: carb</td>
                  <td data-row="16" data-col="1">X</td>
                </tr>
</tbody>
</table>
</div>
<!-- hack to avoid NA insertion in last line -->
</div>
</div>
</section><section id="removing-elements-e.g.-horizontal-rules" class="level2"><h2 class="anchored" data-anchor-id="removing-elements-e.g.-horizontal-rules">Removing elements (e.g.&nbsp;horizontal rules)</h2>
<p>When <code><a href="https://modelsummary.com/man/modelsummary.html">modelsummary()</a></code> creates a <code>tinytable</code>, it fixes a few styling elements immediately, which can cause minor issues when customizing the table further. For example, <code><a href="https://modelsummary.com/man/modelsummary.html">modelsummary()</a></code> draws a separator line to distinguish the coefficients and goodness-of-fit statistics, but this line is drawn at a hard-coded position in the table. If users call <code>tinytable</code> functions to add rows <em>after the fact</em>, the separator line may no longer appear in the correct place.</p>
<p>One way to work around this issue is to manually “flush” all the stylings that <code><a href="https://modelsummary.com/man/modelsummary.html">modelsummary()</a></code> inserted, to start fresh.</p>
<p>To start, notice that added group labels breaks the location of the separator line:</p>
<div class="cell">
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://modelsummary.com">modelsummary</a></span><span class="op">)</span></span>
<span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://vincentarelbundock.github.io/tinytable/">tinytable</a></span><span class="op">)</span></span>
<span><span class="va">mod</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op">(</span><span class="va">mpg</span> <span class="op">~</span> <span class="va">hp</span> <span class="op">+</span> <span class="fu"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op">(</span><span class="va">cyl</span><span class="op">)</span>, data <span class="op">=</span> <span class="va">mtcars</span><span class="op">)</span></span>
<span><span class="va">tab</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">mod</span><span class="op">)</span></span>
<span><span class="va">tab</span> <span class="op">|&gt;</span> <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/group_tt.html">group_tt</a></span><span class="op">(</span>i <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span><span class="st">"Coefs"</span> <span class="op">=</span> <span class="fl">1</span>, <span class="st">"Cylinders"</span> <span class="op">=</span> <span class="fl">5</span><span class="op">)</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<!-- preamble start -->

    <script>

      function styleCell_iimpzyp17s2sm1u3u0z9(i, j, css_id) {
          var table = document.getElementById("tinytable_iimpzyp17s2sm1u3u0z9");
          var cell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
          if (cell) {
              console.log(`Styling cell at (${i}, ${j}) with class ${css_id}`);
              cell.classList.add(css_id);
          } else {
              console.warn(`Cell at (${i}, ${j}) not found.`);
          }
      }
      function spanCell_iimpzyp17s2sm1u3u0z9(i, j, rowspan, colspan) {
        var table = document.getElementById("tinytable_iimpzyp17s2sm1u3u0z9");
        const targetCell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
        if (!targetCell) {
          console.warn(`Cell at (${i}, ${j}) not found.`);
        }

        // Get all cells that need to be removed
        const cellsToRemove = [];
        for (let r = 0; r < rowspan; r++) {
          for (let c = 0; c < colspan; c++) {
            if (r === 0 && c === 0) continue; // Skip the target cell
            const cell = table.querySelector(`[data-row="${i + r}"][data-col="${j + c}"]`);
            if (cell) {
              cellsToRemove.push(cell);
            }
          }
        }

        // Remove all cells
        cellsToRemove.forEach(cell => cell.remove());

        // Set rowspan and colspan of the target cell if it exists
        if (targetCell) {
          targetCell.rowSpan = rowspan;
          targetCell.colSpan = colspan;
        }
      }
      // tinytable span after
      window.addEventListener('load', function () { spanCell_iimpzyp17s2sm1u3u0z9(6, 0, 1, 2) })
      window.addEventListener('load', function () { spanCell_iimpzyp17s2sm1u3u0z9(1, 0, 1, 2) })
      window.addEventListener('load', function () {
          var cellsToStyle = [
            // tinytable style arrays after
          { positions: [ { i: '18', j: 1 },  ], css_id: 'tinytable_css_bnjinhlm86d78wg0ohw1',}, 
          { positions: [ { i: '8', j: 1 },  ], css_id: 'tinytable_css_q7ws3qj000qs4am4c4i5',}, 
          { positions: [ { i: '1', j: 1 }, { i: '2', j: 1 }, { i: '3', j: 1 }, { i: '4', j: 1 }, { i: '5', j: 1 }, { i: '6', j: 1 }, { i: '7', j: 1 }, { i: '12', j: 1 }, { i: '9', j: 1 }, { i: '10', j: 1 }, { i: '11', j: 1 }, { i: '16', j: 1 }, { i: '13', j: 1 }, { i: '14', j: 1 }, { i: '15', j: 1 }, { i: '17', j: 1 },  ], css_id: 'tinytable_css_0byim2akywvzl9af347f',}, 
          { positions: [ { i: '0', j: 1 },  ], css_id: 'tinytable_css_x4krmv9mi7idmp2efodu',}, 
          { positions: [ { i: '18', j: 0 },  ], css_id: 'tinytable_css_ou3w5ubve3gaep3n9r5e',}, 
          { positions: [ { i: '8', j: 0 },  ], css_id: 'tinytable_css_ulocht2pqdorneqqxyf3',}, 
          { positions: [ { i: '1', j: 0 }, { i: '2', j: 0 }, { i: '3', j: 0 }, { i: '4', j: 0 }, { i: '5', j: 0 }, { i: '6', j: 0 }, { i: '7', j: 0 }, { i: '12', j: 0 }, { i: '9', j: 0 }, { i: '10', j: 0 }, { i: '11', j: 0 }, { i: '16', j: 0 }, { i: '13', j: 0 }, { i: '14', j: 0 }, { i: '15', j: 0 }, { i: '17', j: 0 },  ], css_id: 'tinytable_css_th4m8rcqyu49h5zvnwls',}, 
          { positions: [ { i: '0', j: 0 },  ], css_id: 'tinytable_css_ynalv3h5yjyjd9qggr59',}, 
          ];

          // Loop over the arrays to style the cells
          cellsToStyle.forEach(function (group) {
              group.positions.forEach(function (cell) {
                  styleCell_iimpzyp17s2sm1u3u0z9(cell.i, cell.j, group.css_id);
              });
          });
      });
    </script><style>
      /* tinytable css entries after */
      .table td.tinytable_css_bnjinhlm86d78wg0ohw1, .table th.tinytable_css_bnjinhlm86d78wg0ohw1 { text-align: center; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_q7ws3qj000qs4am4c4i5, .table th.tinytable_css_q7ws3qj000qs4am4c4i5 { text-align: center; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_0byim2akywvzl9af347f, .table th.tinytable_css_0byim2akywvzl9af347f { text-align: center; }
      .table td.tinytable_css_x4krmv9mi7idmp2efodu, .table th.tinytable_css_x4krmv9mi7idmp2efodu { text-align: center; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
      .table td.tinytable_css_ou3w5ubve3gaep3n9r5e, .table th.tinytable_css_ou3w5ubve3gaep3n9r5e { text-align: left; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_ulocht2pqdorneqqxyf3, .table th.tinytable_css_ulocht2pqdorneqqxyf3 { text-align: left; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_th4m8rcqyu49h5zvnwls, .table th.tinytable_css_th4m8rcqyu49h5zvnwls { text-align: left; }
      .table td.tinytable_css_ynalv3h5yjyjd9qggr59, .table th.tinytable_css_ynalv3h5yjyjd9qggr59 { text-align: left; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
    </style>
<div class="container">
      <table class="table table-borderless" id="tinytable_iimpzyp17s2sm1u3u0z9" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing="true">
<thead><tr>
<th scope="col" data-row="0" data-col="0"> </th>
                <th scope="col" data-row="0" data-col="1">(1)</th>
              </tr></thead>
<tbody>
<tr>
<td data-row="1" data-col="0">Coefs</td>
                  <td data-row="1" data-col="1">Coefs</td>
                </tr>
<tr>
<td data-row="2" data-col="0">(Intercept)</td>
                  <td data-row="2" data-col="1">28.650</td>
                </tr>
<tr>
<td data-row="3" data-col="0"></td>
                  <td data-row="3" data-col="1">(1.588)</td>
                </tr>
<tr>
<td data-row="4" data-col="0">hp</td>
                  <td data-row="4" data-col="1">-0.024</td>
                </tr>
<tr>
<td data-row="5" data-col="0"></td>
                  <td data-row="5" data-col="1">(0.015)</td>
                </tr>
<tr>
<td data-row="6" data-col="0">Cylinders</td>
                  <td data-row="6" data-col="1">Cylinders</td>
                </tr>
<tr>
<td data-row="7" data-col="0">factor(cyl)6</td>
                  <td data-row="7" data-col="1">-5.968</td>
                </tr>
<tr>
<td data-row="8" data-col="0"></td>
                  <td data-row="8" data-col="1">(1.639)</td>
                </tr>
<tr>
<td data-row="9" data-col="0">factor(cyl)8</td>
                  <td data-row="9" data-col="1">-8.521</td>
                </tr>
<tr>
<td data-row="10" data-col="0"></td>
                  <td data-row="10" data-col="1">(2.326)</td>
                </tr>
<tr>
<td data-row="11" data-col="0">Num.Obs.</td>
                  <td data-row="11" data-col="1">32</td>
                </tr>
<tr>
<td data-row="12" data-col="0">R2</td>
                  <td data-row="12" data-col="1">0.754</td>
                </tr>
<tr>
<td data-row="13" data-col="0">R2 Adj.</td>
                  <td data-row="13" data-col="1">0.727</td>
                </tr>
<tr>
<td data-row="14" data-col="0">AIC</td>
                  <td data-row="14" data-col="1">169.9</td>
                </tr>
<tr>
<td data-row="15" data-col="0">BIC</td>
                  <td data-row="15" data-col="1">177.2</td>
                </tr>
<tr>
<td data-row="16" data-col="0">Log.Lik.</td>
                  <td data-row="16" data-col="1">-79.948</td>
                </tr>
<tr>
<td data-row="17" data-col="0">F</td>
                  <td data-row="17" data-col="1">28.585</td>
                </tr>
<tr>
<td data-row="18" data-col="0">RMSE</td>
                  <td data-row="18" data-col="1">2.94</td>
                </tr>
</tbody>
</table>
</div>
<!-- hack to avoid NA insertion in last line -->
</div>
</div>
<p>To fix this, we create the table, remove styles with the <code><a href="https://vincentarelbundock.github.io/tinytable/man/strip_tt.html">strip_tt()</a></code> function, and then add new ones:</p>
<div class="cell">
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">mod</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span>    <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/strip_tt.html">strip_tt</a></span><span class="op">(</span>line <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span>    <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/group_tt.html">group_tt</a></span><span class="op">(</span>i <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span><span class="st">"Coefs"</span> <span class="op">=</span> <span class="fl">1</span>, <span class="st">"Cylinders"</span> <span class="op">=</span> <span class="fl">5</span><span class="op">)</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span>    <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/style_tt.html">style_tt</a></span><span class="op">(</span>i <span class="op">=</span> <span class="fl">10</span>, line <span class="op">=</span> <span class="st">"b"</span>, line_color <span class="op">=</span> <span class="st">"lightgray"</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<!-- preamble start -->

    <script>

      function styleCell_39c9xussndgiydcm5ns8(i, j, css_id) {
          var table = document.getElementById("tinytable_39c9xussndgiydcm5ns8");
          var cell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
          if (cell) {
              console.log(`Styling cell at (${i}, ${j}) with class ${css_id}`);
              cell.classList.add(css_id);
          } else {
              console.warn(`Cell at (${i}, ${j}) not found.`);
          }
      }
      function spanCell_39c9xussndgiydcm5ns8(i, j, rowspan, colspan) {
        var table = document.getElementById("tinytable_39c9xussndgiydcm5ns8");
        const targetCell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
        if (!targetCell) {
          console.warn(`Cell at (${i}, ${j}) not found.`);
        }

        // Get all cells that need to be removed
        const cellsToRemove = [];
        for (let r = 0; r < rowspan; r++) {
          for (let c = 0; c < colspan; c++) {
            if (r === 0 && c === 0) continue; // Skip the target cell
            const cell = table.querySelector(`[data-row="${i + r}"][data-col="${j + c}"]`);
            if (cell) {
              cellsToRemove.push(cell);
            }
          }
        }

        // Remove all cells
        cellsToRemove.forEach(cell => cell.remove());

        // Set rowspan and colspan of the target cell if it exists
        if (targetCell) {
          targetCell.rowSpan = rowspan;
          targetCell.colSpan = colspan;
        }
      }
      // tinytable span after
      window.addEventListener('load', function () { spanCell_39c9xussndgiydcm5ns8(6, 0, 1, 2) })
      window.addEventListener('load', function () { spanCell_39c9xussndgiydcm5ns8(1, 0, 1, 2) })
      window.addEventListener('load', function () {
          var cellsToStyle = [
            // tinytable style arrays after
          { positions: [ { i: '18', j: 1 },  ], css_id: 'tinytable_css_avc45e6kdi57dufhqbc7',}, 
          { positions: [ { i: '10', j: 1 },  ], css_id: 'tinytable_css_ofozgs94942pvcoccv2h',}, 
          { positions: [ { i: '1', j: 1 }, { i: '2', j: 1 }, { i: '3', j: 1 }, { i: '4', j: 1 }, { i: '5', j: 1 }, { i: '6', j: 1 }, { i: '7', j: 1 }, { i: '8', j: 1 }, { i: '9', j: 1 }, { i: '14', j: 1 }, { i: '11', j: 1 }, { i: '12', j: 1 }, { i: '13', j: 1 }, { i: '15', j: 1 }, { i: '16', j: 1 }, { i: '17', j: 1 },  ], css_id: 'tinytable_css_dba4ta9bqb9asgm60lqk',}, 
          { positions: [ { i: '0', j: 1 },  ], css_id: 'tinytable_css_7rnjj4z6vmf7sjkpz5r4',}, 
          { positions: [ { i: '18', j: 0 },  ], css_id: 'tinytable_css_n2ovnslj9ski6itxqfbk',}, 
          { positions: [ { i: '10', j: 0 },  ], css_id: 'tinytable_css_x0o48bloz8wtmeqdo57i',}, 
          { positions: [ { i: '1', j: 0 }, { i: '2', j: 0 }, { i: '3', j: 0 }, { i: '4', j: 0 }, { i: '5', j: 0 }, { i: '6', j: 0 }, { i: '7', j: 0 }, { i: '8', j: 0 }, { i: '9', j: 0 }, { i: '14', j: 0 }, { i: '11', j: 0 }, { i: '12', j: 0 }, { i: '13', j: 0 }, { i: '15', j: 0 }, { i: '16', j: 0 }, { i: '17', j: 0 },  ], css_id: 'tinytable_css_8y0zi3nxamekm8qmute1',}, 
          { positions: [ { i: '0', j: 0 },  ], css_id: 'tinytable_css_8elhgymjlad57e5xuyu8',}, 
          ];

          // Loop over the arrays to style the cells
          cellsToStyle.forEach(function (group) {
              group.positions.forEach(function (cell) {
                  styleCell_39c9xussndgiydcm5ns8(cell.i, cell.j, group.css_id);
              });
          });
      });
    </script><style>
      /* tinytable css entries after */
      .table td.tinytable_css_avc45e6kdi57dufhqbc7, .table th.tinytable_css_avc45e6kdi57dufhqbc7 { text-align: center; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_ofozgs94942pvcoccv2h, .table th.tinytable_css_ofozgs94942pvcoccv2h { text-align: center; border-bottom: solid #D3D3D3 0.1em; }
      .table td.tinytable_css_dba4ta9bqb9asgm60lqk, .table th.tinytable_css_dba4ta9bqb9asgm60lqk { text-align: center; }
      .table td.tinytable_css_7rnjj4z6vmf7sjkpz5r4, .table th.tinytable_css_7rnjj4z6vmf7sjkpz5r4 { text-align: center; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
      .table td.tinytable_css_n2ovnslj9ski6itxqfbk, .table th.tinytable_css_n2ovnslj9ski6itxqfbk { text-align: left; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_x0o48bloz8wtmeqdo57i, .table th.tinytable_css_x0o48bloz8wtmeqdo57i { text-align: left; border-bottom: solid #D3D3D3 0.1em; }
      .table td.tinytable_css_8y0zi3nxamekm8qmute1, .table th.tinytable_css_8y0zi3nxamekm8qmute1 { text-align: left; }
      .table td.tinytable_css_8elhgymjlad57e5xuyu8, .table th.tinytable_css_8elhgymjlad57e5xuyu8 { text-align: left; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
    </style>
<div class="container">
      <table class="table table-borderless" id="tinytable_39c9xussndgiydcm5ns8" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing="true">
<thead><tr>
<th scope="col" data-row="0" data-col="0"> </th>
                <th scope="col" data-row="0" data-col="1">(1)</th>
              </tr></thead>
<tbody>
<tr>
<td data-row="1" data-col="0">Coefs</td>
                  <td data-row="1" data-col="1">Coefs</td>
                </tr>
<tr>
<td data-row="2" data-col="0">(Intercept)</td>
                  <td data-row="2" data-col="1">28.650</td>
                </tr>
<tr>
<td data-row="3" data-col="0"></td>
                  <td data-row="3" data-col="1">(1.588)</td>
                </tr>
<tr>
<td data-row="4" data-col="0">hp</td>
                  <td data-row="4" data-col="1">-0.024</td>
                </tr>
<tr>
<td data-row="5" data-col="0"></td>
                  <td data-row="5" data-col="1">(0.015)</td>
                </tr>
<tr>
<td data-row="6" data-col="0">Cylinders</td>
                  <td data-row="6" data-col="1">Cylinders</td>
                </tr>
<tr>
<td data-row="7" data-col="0">factor(cyl)6</td>
                  <td data-row="7" data-col="1">-5.968</td>
                </tr>
<tr>
<td data-row="8" data-col="0"></td>
                  <td data-row="8" data-col="1">(1.639)</td>
                </tr>
<tr>
<td data-row="9" data-col="0">factor(cyl)8</td>
                  <td data-row="9" data-col="1">-8.521</td>
                </tr>
<tr>
<td data-row="10" data-col="0"></td>
                  <td data-row="10" data-col="1">(2.326)</td>
                </tr>
<tr>
<td data-row="11" data-col="0">Num.Obs.</td>
                  <td data-row="11" data-col="1">32</td>
                </tr>
<tr>
<td data-row="12" data-col="0">R2</td>
                  <td data-row="12" data-col="1">0.754</td>
                </tr>
<tr>
<td data-row="13" data-col="0">R2 Adj.</td>
                  <td data-row="13" data-col="1">0.727</td>
                </tr>
<tr>
<td data-row="14" data-col="0">AIC</td>
                  <td data-row="14" data-col="1">169.9</td>
                </tr>
<tr>
<td data-row="15" data-col="0">BIC</td>
                  <td data-row="15" data-col="1">177.2</td>
                </tr>
<tr>
<td data-row="16" data-col="0">Log.Lik.</td>
                  <td data-row="16" data-col="1">-79.948</td>
                </tr>
<tr>
<td data-row="17" data-col="0">F</td>
                  <td data-row="17" data-col="1">28.585</td>
                </tr>
<tr>
<td data-row="18" data-col="0">RMSE</td>
                  <td data-row="18" data-col="1">2.94</td>
                </tr>
</tbody>
</table>
</div>
<!-- hack to avoid NA insertion in last line -->
</div>
</div>
</section></section><section id="gt" class="level1"><h1><code>gt</code></h1>
<p>To illustrate how to customize tables using the <code>gt</code> package we will use the following functions from the <code>gt</code> package:</p>
<ul>
<li>
<code>tab_spanner</code> creates labels to group columns.</li>
<li>
<code>tab_footnote</code> adds a footnote and a matching marking in a specific cell.</li>
<li>
<code>tab_style</code> can modify the text and color of rows, columns, or cells.</li>
</ul>
<p>To produce a “cleaner” look, we will also use <code>modelsummary</code>’s <code>stars</code>, <code>coef_map</code>, <code>gof_omit</code>, and <code>title</code> arguments.</p>
<p>Note that in order to access <code>gt</code> functions, we must first load the library.</p>
<div class="cell">
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://gt.rstudio.com">gt</a></span><span class="op">)</span></span>
<span></span>
<span><span class="co">## build table with `modelsummary` </span></span>
<span><span class="va">cm</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span> <span class="st">'(Intercept)'</span> <span class="op">=</span> <span class="st">'Constant'</span>, <span class="st">'Literacy'</span> <span class="op">=</span> <span class="st">'Literacy (%)'</span>, <span class="st">'Clergy'</span> <span class="op">=</span> <span class="st">'Priests/capita'</span><span class="op">)</span></span>
<span><span class="va">cap</span> <span class="op">&lt;-</span> <span class="st">'A modelsummary table customized with gt'</span></span>
<span></span>
<span><span class="va">tab</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">models</span>, </span>
<span>                output <span class="op">=</span> <span class="st">"gt"</span>,</span>
<span>                coef_map <span class="op">=</span> <span class="va">cm</span>, stars <span class="op">=</span> <span class="cn">TRUE</span>, </span>
<span>                title <span class="op">=</span> <span class="va">cap</span>, gof_omit <span class="op">=</span> <span class="st">'IC|Log|Adj'</span><span class="op">)</span> </span>
<span></span>
<span><span class="co">## customize table with `gt`</span></span>
<span></span>
<span><span class="va">tab</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span></span>
<span>    <span class="co"># column labels</span></span>
<span>    <span class="fu"><a href="https://gt.rstudio.com/reference/tab_spanner.html">tab_spanner</a></span><span class="op">(</span>label <span class="op">=</span> <span class="st">'Donations'</span>, columns <span class="op">=</span> <span class="fl">2</span><span class="op">:</span><span class="fl">3</span><span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>    <span class="fu"><a href="https://gt.rstudio.com/reference/tab_spanner.html">tab_spanner</a></span><span class="op">(</span>label <span class="op">=</span> <span class="st">'Crimes (persons)'</span>, columns <span class="op">=</span> <span class="fl">4</span><span class="op">:</span><span class="fl">5</span><span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>    <span class="fu"><a href="https://gt.rstudio.com/reference/tab_spanner.html">tab_spanner</a></span><span class="op">(</span>label <span class="op">=</span> <span class="st">'Crimes (property)'</span>, columns <span class="op">=</span> <span class="fl">6</span><span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span></span>
<span>    <span class="co"># footnote</span></span>
<span>    <span class="fu"><a href="https://gt.rstudio.com/reference/tab_footnote.html">tab_footnote</a></span><span class="op">(</span>footnote <span class="op">=</span> <span class="fu"><a href="https://gt.rstudio.com/reference/md.html">md</a></span><span class="op">(</span><span class="st">"A very **important** variable."</span><span class="op">)</span>,</span>
<span>                 locations <span class="op">=</span> <span class="fu"><a href="https://gt.rstudio.com/reference/cells_body.html">cells_body</a></span><span class="op">(</span>rows <span class="op">=</span> <span class="fl">3</span>, columns <span class="op">=</span> <span class="fl">1</span><span class="op">)</span><span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span></span>
<span>    <span class="co"># text and background color</span></span>
<span>    <span class="fu"><a href="https://gt.rstudio.com/reference/tab_style.html">tab_style</a></span><span class="op">(</span>style <span class="op">=</span> <span class="fu"><a href="https://gt.rstudio.com/reference/cell_text.html">cell_text</a></span><span class="op">(</span>color <span class="op">=</span> <span class="st">'red'</span><span class="op">)</span>,</span>
<span>              locations <span class="op">=</span> <span class="fu"><a href="https://gt.rstudio.com/reference/cells_body.html">cells_body</a></span><span class="op">(</span>rows <span class="op">=</span> <span class="fl">3</span><span class="op">)</span><span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>    <span class="fu"><a href="https://gt.rstudio.com/reference/tab_style.html">tab_style</a></span><span class="op">(</span>style <span class="op">=</span> <span class="fu"><a href="https://gt.rstudio.com/reference/cell_fill.html">cell_fill</a></span><span class="op">(</span>color <span class="op">=</span> <span class="st">'lightblue'</span><span class="op">)</span>,</span>
<span>              locations <span class="op">=</span> <span class="fu"><a href="https://gt.rstudio.com/reference/cells_body.html">cells_body</a></span><span class="op">(</span>rows <span class="op">=</span> <span class="fl">5</span><span class="op">)</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div id="vactltmgrp" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#vactltmgrp table {
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#vactltmgrp thead, #vactltmgrp tbody, #vactltmgrp tfoot, #vactltmgrp tr, #vactltmgrp td, #vactltmgrp th {
  border-style: none;
}

#vactltmgrp p {
  margin: 0;
  padding: 0;
}

#vactltmgrp .gt_table {
  display: table;
  border-collapse: collapse;
  line-height: normal;
  margin-left: auto;
  margin-right: auto;
  color: #333333;
  font-size: 16px;
  font-weight: normal;
  font-style: normal;
  background-color: #FFFFFF;
  width: auto;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #A8A8A8;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #A8A8A8;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
}

#vactltmgrp .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#vactltmgrp .gt_title {
  color: #333333;
  font-size: 125%;
  font-weight: initial;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 0;
}

#vactltmgrp .gt_subtitle {
  color: #333333;
  font-size: 85%;
  font-weight: initial;
  padding-top: 3px;
  padding-bottom: 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-color: #FFFFFF;
  border-top-width: 0;
}

#vactltmgrp .gt_heading {
  background-color: #FFFFFF;
  text-align: center;
  border-bottom-color: #FFFFFF;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#vactltmgrp .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#vactltmgrp .gt_col_headings {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#vactltmgrp .gt_col_heading {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  padding-left: 5px;
  padding-right: 5px;
  overflow-x: hidden;
}

#vactltmgrp .gt_column_spanner_outer {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#vactltmgrp .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#vactltmgrp .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#vactltmgrp .gt_column_spanner {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 5px;
  overflow-x: hidden;
  display: inline-block;
  width: 100%;
}

#vactltmgrp .gt_spanner_row {
  border-bottom-style: hidden;
}

#vactltmgrp .gt_group_heading {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  text-align: left;
}

#vactltmgrp .gt_empty_group_heading {
  padding: 0.5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: middle;
}

#vactltmgrp .gt_from_md > :first-child {
  margin-top: 0;
}

#vactltmgrp .gt_from_md > :last-child {
  margin-bottom: 0;
}

#vactltmgrp .gt_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 10px;
  border-top-style: solid;
  border-top-width: 1px;
  border-top-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  overflow-x: hidden;
}

#vactltmgrp .gt_stub {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
}

#vactltmgrp .gt_stub_row_group {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
  vertical-align: top;
}

#vactltmgrp .gt_row_group_first td {
  border-top-width: 2px;
}

#vactltmgrp .gt_row_group_first th {
  border-top-width: 2px;
}

#vactltmgrp .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#vactltmgrp .gt_first_summary_row {
  border-top-style: solid;
  border-top-color: #D3D3D3;
}

#vactltmgrp .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#vactltmgrp .gt_last_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#vactltmgrp .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#vactltmgrp .gt_first_grand_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: double;
  border-top-width: 6px;
  border-top-color: #D3D3D3;
}

#vactltmgrp .gt_last_grand_summary_row_top {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: double;
  border-bottom-width: 6px;
  border-bottom-color: #D3D3D3;
}

#vactltmgrp .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#vactltmgrp .gt_table_body {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#vactltmgrp .gt_footnotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#vactltmgrp .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#vactltmgrp .gt_sourcenotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#vactltmgrp .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#vactltmgrp .gt_left {
  text-align: left;
}

#vactltmgrp .gt_center {
  text-align: center;
}

#vactltmgrp .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#vactltmgrp .gt_font_normal {
  font-weight: normal;
}

#vactltmgrp .gt_font_bold {
  font-weight: bold;
}

#vactltmgrp .gt_font_italic {
  font-style: italic;
}

#vactltmgrp .gt_super {
  font-size: 65%;
}

#vactltmgrp .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#vactltmgrp .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#vactltmgrp .gt_indent_1 {
  text-indent: 5px;
}

#vactltmgrp .gt_indent_2 {
  text-indent: 10px;
}

#vactltmgrp .gt_indent_3 {
  text-indent: 15px;
}

#vactltmgrp .gt_indent_4 {
  text-indent: 20px;
}

#vactltmgrp .gt_indent_5 {
  text-indent: 25px;
}

#vactltmgrp .katex-display {
  display: inline-flex !important;
  margin-bottom: 0.75em !important;
}

#vactltmgrp div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after {
  height: 0px !important;
}
</style>
<table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<caption>A modelsummary table customized with gt</caption>
  <thead>
<tr class="gt_col_headings gt_spanner_row">
<th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="2" colspan="1" scope="col" id="a-"> </th>
      <th class="gt_center gt_columns_top_border gt_column_spanner_outer" rowspan="1" colspan="2" scope="colgroup" id="Donations">
        <div class="gt_column_spanner">Donations</div>
      </th>
      <th class="gt_center gt_columns_top_border gt_column_spanner_outer" rowspan="1" colspan="2" scope="colgroup" id="Crimes (persons)">
        <div class="gt_column_spanner">Crimes (persons)</div>
      </th>
      <th class="gt_center gt_columns_top_border gt_column_spanner_outer" rowspan="1" colspan="1" scope="col" id="Crimes (property)">
        <div class="gt_column_spanner">Crimes (property)</div>
      </th>
    </tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="I">I</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="II">II</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="III">III</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="IV">IV</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="V">V</th>
    </tr>
</thead>
<tbody class="gt_table_body">
<tr>
<td headers=" " class="gt_row gt_left">Constant</td>
<td headers="I" class="gt_row gt_center">8759.068***</td>
<td headers="II" class="gt_row gt_center">20357.309***</td>
<td headers="III" class="gt_row gt_center">11243.544***</td>
<td headers="IV" class="gt_row gt_center">9.708***</td>
<td headers="V" class="gt_row gt_center">8.986***</td>
</tr>
<tr>
<td headers=" " class="gt_row gt_left"></td>
<td headers="I" class="gt_row gt_center">(1559.363)</td>
<td headers="II" class="gt_row gt_center">(2020.980)</td>
<td headers="III" class="gt_row gt_center">(1011.240)</td>
<td headers="IV" class="gt_row gt_center">(0.003)</td>
<td headers="V" class="gt_row gt_center">(0.004)</td>
</tr>
<tr>
<td headers=" " class="gt_row gt_left" style="color: #FF0000;">Literacy (%)<span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;"><sup>1</sup></span>
</td>
<td headers="I" class="gt_row gt_center" style="color: #FF0000;">-42.886</td>
<td headers="II" class="gt_row gt_center" style="color: #FF0000;">-15.358</td>
<td headers="III" class="gt_row gt_center" style="color: #FF0000;">-68.507***</td>
<td headers="IV" class="gt_row gt_center" style="color: #FF0000;">0.000***</td>
<td headers="V" class="gt_row gt_center" style="color: #FF0000;">-0.006***</td>
</tr>
<tr>
<td headers=" " class="gt_row gt_left"></td>
<td headers="I" class="gt_row gt_center">(36.362)</td>
<td headers="II" class="gt_row gt_center">(47.127)</td>
<td headers="III" class="gt_row gt_center">(18.029)</td>
<td headers="IV" class="gt_row gt_center">(0.000)</td>
<td headers="V" class="gt_row gt_center">(0.000)</td>
</tr>
<tr>
<td headers=" " class="gt_row gt_left" style="background-color: #ADD8E6;">Priests/capita</td>
<td headers="I" class="gt_row gt_center" style="background-color: #ADD8E6;"></td>
<td headers="II" class="gt_row gt_center" style="background-color: #ADD8E6;"></td>
<td headers="III" class="gt_row gt_center" style="background-color: #ADD8E6;">-16.376</td>
<td headers="IV" class="gt_row gt_center" style="background-color: #ADD8E6;">0.004***</td>
<td headers="V" class="gt_row gt_center" style="background-color: #ADD8E6;">0.002***</td>
</tr>
<tr>
<td headers=" " class="gt_row gt_left" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000;"></td>
<td headers="I" class="gt_row gt_center" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000;"></td>
<td headers="II" class="gt_row gt_center" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000;"></td>
<td headers="III" class="gt_row gt_center" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000;">(12.522)</td>
<td headers="IV" class="gt_row gt_center" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000;">(0.000)</td>
<td headers="V" class="gt_row gt_center" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000;">(0.000)</td>
</tr>
<tr>
<td headers=" " class="gt_row gt_left">Num.Obs.</td>
<td headers="I" class="gt_row gt_center">86</td>
<td headers="II" class="gt_row gt_center">86</td>
<td headers="III" class="gt_row gt_center">86</td>
<td headers="IV" class="gt_row gt_center">86</td>
<td headers="V" class="gt_row gt_center">86</td>
</tr>
<tr>
<td headers=" " class="gt_row gt_left">R2</td>
<td headers="I" class="gt_row gt_center">0.016</td>
<td headers="II" class="gt_row gt_center">0.001</td>
<td headers="III" class="gt_row gt_center">0.152</td>
<td headers="IV" class="gt_row gt_center"></td>
<td headers="V" class="gt_row gt_center"></td>
</tr>
<tr>
<td headers=" " class="gt_row gt_left">F</td>
<td headers="I" class="gt_row gt_center">1.391</td>
<td headers="II" class="gt_row gt_center">0.106</td>
<td headers="III" class="gt_row gt_center">7.441</td>
<td headers="IV" class="gt_row gt_center">7905.811</td>
<td headers="V" class="gt_row gt_center">4170.610</td>
</tr>
<tr>
<td headers=" " class="gt_row gt_left">RMSE</td>
<td headers="I" class="gt_row gt_center">5753.14</td>
<td headers="II" class="gt_row gt_center">7456.23</td>
<td headers="III" class="gt_row gt_center">2793.43</td>
<td headers="IV" class="gt_row gt_center">7233.22</td>
<td headers="V" class="gt_row gt_center">5727.27</td>
</tr>
</tbody>
<tfoot class="gt_sourcenotes"><tr>
<td class="gt_sourcenote" colspan="6">+ p &lt; 0.1, * p &lt; 0.05, ** p &lt; 0.01, *** p &lt; 0.001</td>
    </tr></tfoot>
<tfoot class="gt_footnotes"><tr>
<td class="gt_footnote" colspan="6">
<span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;line-height:0;"><sup>1</sup></span> <span data-qmd-base64="QSB2ZXJ5ICoqaW1wb3J0YW50KiogdmFyaWFibGUu"><span class="gt_from_md">A very <strong>important</strong> variable.</span></span>
</td>
    </tr></tfoot>
</table>
</div>
</div>
</div>
<p>The <a href="https://gt.rstudio.com"><code>gt</code> website</a> offers many more examples. The possibilities are endless. For instance, <code>gt</code> allows you to embed images in your tables using the <code>text_transform</code> and <code>local_image</code> functions:</p>
<div class="cell">
<div class="sourceCode" id="cb11"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va">f</span> <span class="op">&lt;-</span> <span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fu"><a href="https://gt.rstudio.com/reference/web_image.html">web_image</a></span><span class="op">(</span>url <span class="op">=</span> <span class="st">"https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png"</span>, height <span class="op">=</span> <span class="fl">80</span><span class="op">)</span></span>
<span></span>
<span><span class="va">tab</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> </span>
<span>    <span class="fu"><a href="https://gt.rstudio.com/reference/text_transform.html">text_transform</a></span><span class="op">(</span>locations <span class="op">=</span> <span class="fu"><a href="https://gt.rstudio.com/reference/cells_body.html">cells_body</a></span><span class="op">(</span>columns <span class="op">=</span> <span class="fl">2</span><span class="op">:</span><span class="fl">6</span>, rows <span class="op">=</span> <span class="fl">1</span><span class="op">)</span>, fn <span class="op">=</span> <span class="va">f</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div id="xsxmfgdpxc" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#xsxmfgdpxc table {
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#xsxmfgdpxc thead, #xsxmfgdpxc tbody, #xsxmfgdpxc tfoot, #xsxmfgdpxc tr, #xsxmfgdpxc td, #xsxmfgdpxc th {
  border-style: none;
}

#xsxmfgdpxc p {
  margin: 0;
  padding: 0;
}

#xsxmfgdpxc .gt_table {
  display: table;
  border-collapse: collapse;
  line-height: normal;
  margin-left: auto;
  margin-right: auto;
  color: #333333;
  font-size: 16px;
  font-weight: normal;
  font-style: normal;
  background-color: #FFFFFF;
  width: auto;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #A8A8A8;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #A8A8A8;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
}

#xsxmfgdpxc .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#xsxmfgdpxc .gt_title {
  color: #333333;
  font-size: 125%;
  font-weight: initial;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 0;
}

#xsxmfgdpxc .gt_subtitle {
  color: #333333;
  font-size: 85%;
  font-weight: initial;
  padding-top: 3px;
  padding-bottom: 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-color: #FFFFFF;
  border-top-width: 0;
}

#xsxmfgdpxc .gt_heading {
  background-color: #FFFFFF;
  text-align: center;
  border-bottom-color: #FFFFFF;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#xsxmfgdpxc .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#xsxmfgdpxc .gt_col_headings {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#xsxmfgdpxc .gt_col_heading {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  padding-left: 5px;
  padding-right: 5px;
  overflow-x: hidden;
}

#xsxmfgdpxc .gt_column_spanner_outer {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#xsxmfgdpxc .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#xsxmfgdpxc .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#xsxmfgdpxc .gt_column_spanner {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 5px;
  overflow-x: hidden;
  display: inline-block;
  width: 100%;
}

#xsxmfgdpxc .gt_spanner_row {
  border-bottom-style: hidden;
}

#xsxmfgdpxc .gt_group_heading {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  text-align: left;
}

#xsxmfgdpxc .gt_empty_group_heading {
  padding: 0.5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: middle;
}

#xsxmfgdpxc .gt_from_md > :first-child {
  margin-top: 0;
}

#xsxmfgdpxc .gt_from_md > :last-child {
  margin-bottom: 0;
}

#xsxmfgdpxc .gt_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 10px;
  border-top-style: solid;
  border-top-width: 1px;
  border-top-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  overflow-x: hidden;
}

#xsxmfgdpxc .gt_stub {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
}

#xsxmfgdpxc .gt_stub_row_group {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
  vertical-align: top;
}

#xsxmfgdpxc .gt_row_group_first td {
  border-top-width: 2px;
}

#xsxmfgdpxc .gt_row_group_first th {
  border-top-width: 2px;
}

#xsxmfgdpxc .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#xsxmfgdpxc .gt_first_summary_row {
  border-top-style: solid;
  border-top-color: #D3D3D3;
}

#xsxmfgdpxc .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#xsxmfgdpxc .gt_last_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#xsxmfgdpxc .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#xsxmfgdpxc .gt_first_grand_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: double;
  border-top-width: 6px;
  border-top-color: #D3D3D3;
}

#xsxmfgdpxc .gt_last_grand_summary_row_top {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: double;
  border-bottom-width: 6px;
  border-bottom-color: #D3D3D3;
}

#xsxmfgdpxc .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#xsxmfgdpxc .gt_table_body {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#xsxmfgdpxc .gt_footnotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#xsxmfgdpxc .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#xsxmfgdpxc .gt_sourcenotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#xsxmfgdpxc .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#xsxmfgdpxc .gt_left {
  text-align: left;
}

#xsxmfgdpxc .gt_center {
  text-align: center;
}

#xsxmfgdpxc .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#xsxmfgdpxc .gt_font_normal {
  font-weight: normal;
}

#xsxmfgdpxc .gt_font_bold {
  font-weight: bold;
}

#xsxmfgdpxc .gt_font_italic {
  font-style: italic;
}

#xsxmfgdpxc .gt_super {
  font-size: 65%;
}

#xsxmfgdpxc .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#xsxmfgdpxc .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#xsxmfgdpxc .gt_indent_1 {
  text-indent: 5px;
}

#xsxmfgdpxc .gt_indent_2 {
  text-indent: 10px;
}

#xsxmfgdpxc .gt_indent_3 {
  text-indent: 15px;
}

#xsxmfgdpxc .gt_indent_4 {
  text-indent: 20px;
}

#xsxmfgdpxc .gt_indent_5 {
  text-indent: 25px;
}

#xsxmfgdpxc .katex-display {
  display: inline-flex !important;
  margin-bottom: 0.75em !important;
}

#xsxmfgdpxc div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after {
  height: 0px !important;
}
</style>
<table class="gt_table caption-top table table-sm table-striped small" data-quarto-postprocess="true" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<caption>A modelsummary table customized with gt</caption>
<thead><tr class="gt_col_headings header">
<th id="a-" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col"></th>
<th id="I" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col">I</th>
<th id="II" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col">II</th>
<th id="III" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col">III</th>
<th id="IV" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col">IV</th>
<th id="V" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col">V</th>
</tr></thead>
<tbody class="gt_table_body">
<tr class="odd">
<td class="gt_row gt_left" headers=" ">Constant</td>
<td class="gt_row gt_center" headers="I"><img src="https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png" class="img-fluid" style="height:80px;"></td>
<td class="gt_row gt_center" headers="II"><img src="https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png" class="img-fluid" style="height:80px;"></td>
<td class="gt_row gt_center" headers="III"><img src="https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png" class="img-fluid" style="height:80px;"></td>
<td class="gt_row gt_center" headers="IV"><img src="https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png" class="img-fluid" style="height:80px;"></td>
<td class="gt_row gt_center" headers="V"><img src="https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png" class="img-fluid" style="height:80px;"></td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers=" "></td>
<td class="gt_row gt_center" headers="I">(1559.363)</td>
<td class="gt_row gt_center" headers="II">(2020.980)</td>
<td class="gt_row gt_center" headers="III">(1011.240)</td>
<td class="gt_row gt_center" headers="IV">(0.003)</td>
<td class="gt_row gt_center" headers="V">(0.004)</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers=" ">Literacy (%)</td>
<td class="gt_row gt_center" headers="I">-42.886</td>
<td class="gt_row gt_center" headers="II">-15.358</td>
<td class="gt_row gt_center" headers="III">-68.507***</td>
<td class="gt_row gt_center" headers="IV">0.000***</td>
<td class="gt_row gt_center" headers="V">-0.006***</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers=" "></td>
<td class="gt_row gt_center" headers="I">(36.362)</td>
<td class="gt_row gt_center" headers="II">(47.127)</td>
<td class="gt_row gt_center" headers="III">(18.029)</td>
<td class="gt_row gt_center" headers="IV">(0.000)</td>
<td class="gt_row gt_center" headers="V">(0.000)</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers=" ">Priests/capita</td>
<td class="gt_row gt_center" headers="I"></td>
<td class="gt_row gt_center" headers="II"></td>
<td class="gt_row gt_center" headers="III">-16.376</td>
<td class="gt_row gt_center" headers="IV">0.004***</td>
<td class="gt_row gt_center" headers="V">0.002***</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers=" " style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000"></td>
<td class="gt_row gt_center" headers="I" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000"></td>
<td class="gt_row gt_center" headers="II" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000"></td>
<td class="gt_row gt_center" headers="III" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000">(12.522)</td>
<td class="gt_row gt_center" headers="IV" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000">(0.000)</td>
<td class="gt_row gt_center" headers="V" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #000000">(0.000)</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers=" ">Num.Obs.</td>
<td class="gt_row gt_center" headers="I">86</td>
<td class="gt_row gt_center" headers="II">86</td>
<td class="gt_row gt_center" headers="III">86</td>
<td class="gt_row gt_center" headers="IV">86</td>
<td class="gt_row gt_center" headers="V">86</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers=" ">R2</td>
<td class="gt_row gt_center" headers="I">0.016</td>
<td class="gt_row gt_center" headers="II">0.001</td>
<td class="gt_row gt_center" headers="III">0.152</td>
<td class="gt_row gt_center" headers="IV"></td>
<td class="gt_row gt_center" headers="V"></td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers=" ">F</td>
<td class="gt_row gt_center" headers="I">1.391</td>
<td class="gt_row gt_center" headers="II">0.106</td>
<td class="gt_row gt_center" headers="III">7.441</td>
<td class="gt_row gt_center" headers="IV">7905.811</td>
<td class="gt_row gt_center" headers="V">4170.610</td>
</tr>
<tr class="even">
<td class="gt_row gt_left" headers=" ">RMSE</td>
<td class="gt_row gt_center" headers="I">5753.14</td>
<td class="gt_row gt_center" headers="II">7456.23</td>
<td class="gt_row gt_center" headers="III">2793.43</td>
<td class="gt_row gt_center" headers="IV">7233.22</td>
<td class="gt_row gt_center" headers="V">5727.27</td>
</tr>
</tbody>
<tfoot class="gt_sourcenotes"><tr class="odd">
<td colspan="6" class="gt_sourcenote">+ p &lt; 0.1, * p &lt; 0.05, ** p &lt; 0.01, *** p &lt; 0.001</td>
</tr></tfoot>
</table>
</div>
</div>
</div>
</section><section id="themes" class="level1"><h1>Themes</h1>
<p>If you want to apply the same post-processing functions to your tables, you can use <code>modelsummary</code>’s theming functionality. To do so, we first create a function to post-process a table. This function must accept a table as its first argument, and include the ellipsis (<code>...</code>). Optionally, the theming function can also accept an <code>hrule</code> argument which is a vector of row positions where we insert horizontal rule, and an <code>output_format</code> which allows output format-specific customization. For inspiration, you may want to consult the default <code>modelsummary</code> themes in the <a href="https://github.com/vincentarelbundock/modelsummary"><code>themes.R</code> file of the Github repository.</a></p>
<p>Once the theming function is created, we assign it to a global option called <code>modelsummary_theme_kableExtra</code>, <code>modelsummary_theme_gt</code>, <code>modelsummary_theme_flextable</code>, or <code>modelsummary_theme_huxtable</code>. For example, if you want to add row striping to all your <code>gt</code> tables:</p>
<div class="cell">
<div class="sourceCode" id="cb12"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://gt.rstudio.com">gt</a></span><span class="op">)</span></span>
<span></span>
<span><span class="co">## The ... ellipsis is required!</span></span>
<span><span class="va">custom_theme</span> <span class="op">&lt;-</span> <span class="kw">function</span><span class="op">(</span><span class="va">x</span>, <span class="va">...</span><span class="op">)</span> <span class="op">{</span></span>
<span>    <span class="va">x</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> <span class="fu">gt</span><span class="fu">::</span><span class="fu"><a href="https://gt.rstudio.com/reference/opt_row_striping.html">opt_row_striping</a></span><span class="op">(</span>row_striping <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span>
<span><span class="op">}</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/options.html">options</a></span><span class="op">(</span><span class="st">"modelsummary_theme_gt"</span> <span class="op">=</span> <span class="va">custom_theme</span><span class="op">)</span></span>
<span></span>
<span><span class="va">mod</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op">(</span><span class="va">mpg</span> <span class="op">~</span> <span class="va">hp</span> <span class="op">+</span> <span class="va">drat</span>, <span class="va">mtcars</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">mod</span>, output <span class="op">=</span> <span class="st">"gt"</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div id="lwzbmisgqm" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#lwzbmisgqm table {
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#lwzbmisgqm thead, #lwzbmisgqm tbody, #lwzbmisgqm tfoot, #lwzbmisgqm tr, #lwzbmisgqm td, #lwzbmisgqm th {
  border-style: none;
}

#lwzbmisgqm p {
  margin: 0;
  padding: 0;
}

#lwzbmisgqm .gt_table {
  display: table;
  border-collapse: collapse;
  line-height: normal;
  margin-left: auto;
  margin-right: auto;
  color: #333333;
  font-size: 16px;
  font-weight: normal;
  font-style: normal;
  background-color: #FFFFFF;
  width: auto;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #A8A8A8;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #A8A8A8;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
}

#lwzbmisgqm .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#lwzbmisgqm .gt_title {
  color: #333333;
  font-size: 125%;
  font-weight: initial;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 0;
}

#lwzbmisgqm .gt_subtitle {
  color: #333333;
  font-size: 85%;
  font-weight: initial;
  padding-top: 3px;
  padding-bottom: 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-color: #FFFFFF;
  border-top-width: 0;
}

#lwzbmisgqm .gt_heading {
  background-color: #FFFFFF;
  text-align: center;
  border-bottom-color: #FFFFFF;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#lwzbmisgqm .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#lwzbmisgqm .gt_col_headings {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#lwzbmisgqm .gt_col_heading {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  padding-left: 5px;
  padding-right: 5px;
  overflow-x: hidden;
}

#lwzbmisgqm .gt_column_spanner_outer {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#lwzbmisgqm .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#lwzbmisgqm .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#lwzbmisgqm .gt_column_spanner {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 5px;
  overflow-x: hidden;
  display: inline-block;
  width: 100%;
}

#lwzbmisgqm .gt_spanner_row {
  border-bottom-style: hidden;
}

#lwzbmisgqm .gt_group_heading {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  text-align: left;
}

#lwzbmisgqm .gt_empty_group_heading {
  padding: 0.5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: middle;
}

#lwzbmisgqm .gt_from_md > :first-child {
  margin-top: 0;
}

#lwzbmisgqm .gt_from_md > :last-child {
  margin-bottom: 0;
}

#lwzbmisgqm .gt_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 10px;
  border-top-style: solid;
  border-top-width: 1px;
  border-top-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  overflow-x: hidden;
}

#lwzbmisgqm .gt_stub {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
}

#lwzbmisgqm .gt_stub_row_group {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
  vertical-align: top;
}

#lwzbmisgqm .gt_row_group_first td {
  border-top-width: 2px;
}

#lwzbmisgqm .gt_row_group_first th {
  border-top-width: 2px;
}

#lwzbmisgqm .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#lwzbmisgqm .gt_first_summary_row {
  border-top-style: solid;
  border-top-color: #D3D3D3;
}

#lwzbmisgqm .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#lwzbmisgqm .gt_last_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#lwzbmisgqm .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#lwzbmisgqm .gt_first_grand_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: double;
  border-top-width: 6px;
  border-top-color: #D3D3D3;
}

#lwzbmisgqm .gt_last_grand_summary_row_top {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: double;
  border-bottom-width: 6px;
  border-bottom-color: #D3D3D3;
}

#lwzbmisgqm .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#lwzbmisgqm .gt_table_body {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#lwzbmisgqm .gt_footnotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#lwzbmisgqm .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#lwzbmisgqm .gt_sourcenotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#lwzbmisgqm .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#lwzbmisgqm .gt_left {
  text-align: left;
}

#lwzbmisgqm .gt_center {
  text-align: center;
}

#lwzbmisgqm .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#lwzbmisgqm .gt_font_normal {
  font-weight: normal;
}

#lwzbmisgqm .gt_font_bold {
  font-weight: bold;
}

#lwzbmisgqm .gt_font_italic {
  font-style: italic;
}

#lwzbmisgqm .gt_super {
  font-size: 65%;
}

#lwzbmisgqm .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#lwzbmisgqm .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#lwzbmisgqm .gt_indent_1 {
  text-indent: 5px;
}

#lwzbmisgqm .gt_indent_2 {
  text-indent: 10px;
}

#lwzbmisgqm .gt_indent_3 {
  text-indent: 15px;
}

#lwzbmisgqm .gt_indent_4 {
  text-indent: 20px;
}

#lwzbmisgqm .gt_indent_5 {
  text-indent: 25px;
}

#lwzbmisgqm .katex-display {
  display: inline-flex !important;
  margin-bottom: 0.75em !important;
}

#lwzbmisgqm div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after {
  height: 0px !important;
}
</style>
<table class="gt_table caption-top table table-sm table-striped small" data-quarto-postprocess="true" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead><tr class="gt_col_headings header">
<th id="a-" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col"></th>
<th id="a(1)" class="gt_col_heading gt_columns_bottom_border gt_center" data-quarto-table-cell-role="th" scope="col">(1)</th>
</tr></thead>
<tbody class="gt_table_body">
<tr class="odd">
<td class="gt_row gt_left" headers=" ">(Intercept)</td>
<td class="gt_row gt_center" headers="(1)">10.790</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers=" "></td>
<td class="gt_row gt_center gt_striped" headers="(1)">(5.078)</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers=" ">hp</td>
<td class="gt_row gt_center" headers="(1)">-0.052</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers=" "></td>
<td class="gt_row gt_center gt_striped" headers="(1)">(0.009)</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers=" ">drat</td>
<td class="gt_row gt_center" headers="(1)">4.698</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers=" "></td>
<td class="gt_row gt_center gt_striped" headers="(1)">(1.192)</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers=" ">Num.Obs.</td>
<td class="gt_row gt_center" headers="(1)">32</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers=" ">R2</td>
<td class="gt_row gt_center gt_striped" headers="(1)">0.741</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers=" ">R2 Adj.</td>
<td class="gt_row gt_center" headers="(1)">0.723</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers=" ">AIC</td>
<td class="gt_row gt_center gt_striped" headers="(1)">169.5</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers=" ">BIC</td>
<td class="gt_row gt_center" headers="(1)">175.4</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers=" ">Log.Lik.</td>
<td class="gt_row gt_center gt_striped" headers="(1)">-80.752</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers=" ">F</td>
<td class="gt_row gt_center" headers="(1)">41.522</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers=" ">RMSE</td>
<td class="gt_row gt_center gt_striped" headers="(1)">3.02</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="cell">
<div class="sourceCode" id="cb13"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va">url</span> <span class="op">&lt;-</span> <span class="st">'https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv'</span></span>
<span><span class="va">penguins</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/utils/read.table.html">read.csv</a></span><span class="op">(</span><span class="va">url</span>, na.strings <span class="op">=</span> <span class="st">""</span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/datasummary_crosstab.html">datasummary_crosstab</a></span><span class="op">(</span><span class="va">island</span> <span class="op">~</span> <span class="va">sex</span> <span class="op">*</span> <span class="va">species</span>, output <span class="op">=</span> <span class="st">"gt"</span>, data <span class="op">=</span> <span class="va">penguins</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div id="rvoprclgjw" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#rvoprclgjw table {
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#rvoprclgjw thead, #rvoprclgjw tbody, #rvoprclgjw tfoot, #rvoprclgjw tr, #rvoprclgjw td, #rvoprclgjw th {
  border-style: none;
}

#rvoprclgjw p {
  margin: 0;
  padding: 0;
}

#rvoprclgjw .gt_table {
  display: table;
  border-collapse: collapse;
  line-height: normal;
  margin-left: auto;
  margin-right: auto;
  color: #333333;
  font-size: 16px;
  font-weight: normal;
  font-style: normal;
  background-color: #FFFFFF;
  width: auto;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #A8A8A8;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #A8A8A8;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
}

#rvoprclgjw .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#rvoprclgjw .gt_title {
  color: #333333;
  font-size: 125%;
  font-weight: initial;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 0;
}

#rvoprclgjw .gt_subtitle {
  color: #333333;
  font-size: 85%;
  font-weight: initial;
  padding-top: 3px;
  padding-bottom: 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-color: #FFFFFF;
  border-top-width: 0;
}

#rvoprclgjw .gt_heading {
  background-color: #FFFFFF;
  text-align: center;
  border-bottom-color: #FFFFFF;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#rvoprclgjw .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#rvoprclgjw .gt_col_headings {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#rvoprclgjw .gt_col_heading {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  padding-left: 5px;
  padding-right: 5px;
  overflow-x: hidden;
}

#rvoprclgjw .gt_column_spanner_outer {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#rvoprclgjw .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#rvoprclgjw .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#rvoprclgjw .gt_column_spanner {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 5px;
  overflow-x: hidden;
  display: inline-block;
  width: 100%;
}

#rvoprclgjw .gt_spanner_row {
  border-bottom-style: hidden;
}

#rvoprclgjw .gt_group_heading {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  text-align: left;
}

#rvoprclgjw .gt_empty_group_heading {
  padding: 0.5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: middle;
}

#rvoprclgjw .gt_from_md > :first-child {
  margin-top: 0;
}

#rvoprclgjw .gt_from_md > :last-child {
  margin-bottom: 0;
}

#rvoprclgjw .gt_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 10px;
  border-top-style: solid;
  border-top-width: 1px;
  border-top-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  overflow-x: hidden;
}

#rvoprclgjw .gt_stub {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
}

#rvoprclgjw .gt_stub_row_group {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 5px;
  padding-right: 5px;
  vertical-align: top;
}

#rvoprclgjw .gt_row_group_first td {
  border-top-width: 2px;
}

#rvoprclgjw .gt_row_group_first th {
  border-top-width: 2px;
}

#rvoprclgjw .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#rvoprclgjw .gt_first_summary_row {
  border-top-style: solid;
  border-top-color: #D3D3D3;
}

#rvoprclgjw .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#rvoprclgjw .gt_last_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#rvoprclgjw .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#rvoprclgjw .gt_first_grand_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: double;
  border-top-width: 6px;
  border-top-color: #D3D3D3;
}

#rvoprclgjw .gt_last_grand_summary_row_top {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-bottom-style: double;
  border-bottom-width: 6px;
  border-bottom-color: #D3D3D3;
}

#rvoprclgjw .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#rvoprclgjw .gt_table_body {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#rvoprclgjw .gt_footnotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#rvoprclgjw .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#rvoprclgjw .gt_sourcenotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#rvoprclgjw .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#rvoprclgjw .gt_left {
  text-align: left;
}

#rvoprclgjw .gt_center {
  text-align: center;
}

#rvoprclgjw .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#rvoprclgjw .gt_font_normal {
  font-weight: normal;
}

#rvoprclgjw .gt_font_bold {
  font-weight: bold;
}

#rvoprclgjw .gt_font_italic {
  font-style: italic;
}

#rvoprclgjw .gt_super {
  font-size: 65%;
}

#rvoprclgjw .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#rvoprclgjw .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#rvoprclgjw .gt_indent_1 {
  text-indent: 5px;
}

#rvoprclgjw .gt_indent_2 {
  text-indent: 10px;
}

#rvoprclgjw .gt_indent_3 {
  text-indent: 15px;
}

#rvoprclgjw .gt_indent_4 {
  text-indent: 20px;
}

#rvoprclgjw .gt_indent_5 {
  text-indent: 25px;
}

#rvoprclgjw .katex-display {
  display: inline-flex !important;
  margin-bottom: 0.75em !important;
}

#rvoprclgjw div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after {
  height: 0px !important;
}
</style>
<table class="gt_table caption-top table table-sm table-striped small" data-quarto-postprocess="true" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<colgroup>
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 11%">
<col style="width: 11%">
</colgroup>
<thead>
<tr class="gt_col_headings gt_spanner_row header">
<th rowspan="2" id="island" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col">island</th>
<th rowspan="2" id="a-" class="gt_col_heading gt_columns_bottom_border gt_left" data-quarto-table-cell-role="th" scope="col"></th>
<th colspan="3" id="female    " class="gt_center gt_columns_top_border gt_column_spanner_outer" data-quarto-table-cell-role="th" scope="colgroup"><div class="gt_column_spanner">
female
</div></th>
<th colspan="3" id="male    " class="gt_center gt_columns_top_border gt_column_spanner_outer" data-quarto-table-cell-role="th" scope="colgroup"><div class="gt_column_spanner">
male
</div></th>
<th rowspan="2" id="All" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" scope="col">All</th>
</tr>
<tr class="gt_col_headings even">
<th id="Adelie" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" scope="col">Adelie</th>
<th id="Chinstrap" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" scope="col">Chinstrap</th>
<th id="Gentoo" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" scope="col">Gentoo</th>
<th id="Adelie-" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" scope="col">Adelie</th>
<th id="Chinstrap-" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" scope="col">Chinstrap</th>
<th id="Gentoo-" class="gt_col_heading gt_columns_bottom_border gt_right" data-quarto-table-cell-role="th" scope="col">Gentoo</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr class="odd">
<td class="gt_row gt_left" headers="island">Biscoe</td>
<td class="gt_row gt_left" headers=" ">N</td>
<td class="gt_row gt_right" headers="Adelie">22</td>
<td class="gt_row gt_right" headers="Chinstrap">0</td>
<td class="gt_row gt_right" headers="Gentoo">58</td>
<td class="gt_row gt_right" headers="Adelie ">22</td>
<td class="gt_row gt_right" headers="Chinstrap ">0</td>
<td class="gt_row gt_right" headers="Gentoo ">61</td>
<td class="gt_row gt_right" headers="All">168</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="island"></td>
<td class="gt_row gt_left gt_striped" headers=" ">% row</td>
<td class="gt_row gt_right gt_striped" headers="Adelie">13.1</td>
<td class="gt_row gt_right gt_striped" headers="Chinstrap">0.0</td>
<td class="gt_row gt_right gt_striped" headers="Gentoo">34.5</td>
<td class="gt_row gt_right gt_striped" headers="Adelie ">13.1</td>
<td class="gt_row gt_right gt_striped" headers="Chinstrap ">0.0</td>
<td class="gt_row gt_right gt_striped" headers="Gentoo ">36.3</td>
<td class="gt_row gt_right gt_striped" headers="All">100.0</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="island">Dream</td>
<td class="gt_row gt_left" headers=" ">N</td>
<td class="gt_row gt_right" headers="Adelie">27</td>
<td class="gt_row gt_right" headers="Chinstrap">34</td>
<td class="gt_row gt_right" headers="Gentoo">0</td>
<td class="gt_row gt_right" headers="Adelie ">28</td>
<td class="gt_row gt_right" headers="Chinstrap ">34</td>
<td class="gt_row gt_right" headers="Gentoo ">0</td>
<td class="gt_row gt_right" headers="All">124</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="island"></td>
<td class="gt_row gt_left gt_striped" headers=" ">% row</td>
<td class="gt_row gt_right gt_striped" headers="Adelie">21.8</td>
<td class="gt_row gt_right gt_striped" headers="Chinstrap">27.4</td>
<td class="gt_row gt_right gt_striped" headers="Gentoo">0.0</td>
<td class="gt_row gt_right gt_striped" headers="Adelie ">22.6</td>
<td class="gt_row gt_right gt_striped" headers="Chinstrap ">27.4</td>
<td class="gt_row gt_right gt_striped" headers="Gentoo ">0.0</td>
<td class="gt_row gt_right gt_striped" headers="All">100.0</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="island">Torgersen</td>
<td class="gt_row gt_left" headers=" ">N</td>
<td class="gt_row gt_right" headers="Adelie">24</td>
<td class="gt_row gt_right" headers="Chinstrap">0</td>
<td class="gt_row gt_right" headers="Gentoo">0</td>
<td class="gt_row gt_right" headers="Adelie ">23</td>
<td class="gt_row gt_right" headers="Chinstrap ">0</td>
<td class="gt_row gt_right" headers="Gentoo ">0</td>
<td class="gt_row gt_right" headers="All">52</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="island"></td>
<td class="gt_row gt_left gt_striped" headers=" ">% row</td>
<td class="gt_row gt_right gt_striped" headers="Adelie">46.2</td>
<td class="gt_row gt_right gt_striped" headers="Chinstrap">0.0</td>
<td class="gt_row gt_right gt_striped" headers="Gentoo">0.0</td>
<td class="gt_row gt_right gt_striped" headers="Adelie ">44.2</td>
<td class="gt_row gt_right gt_striped" headers="Chinstrap ">0.0</td>
<td class="gt_row gt_right gt_striped" headers="Gentoo ">0.0</td>
<td class="gt_row gt_right gt_striped" headers="All">100.0</td>
</tr>
<tr class="odd">
<td class="gt_row gt_left" headers="island">All</td>
<td class="gt_row gt_left" headers=" ">N</td>
<td class="gt_row gt_right" headers="Adelie">73</td>
<td class="gt_row gt_right" headers="Chinstrap">34</td>
<td class="gt_row gt_right" headers="Gentoo">58</td>
<td class="gt_row gt_right" headers="Adelie ">73</td>
<td class="gt_row gt_right" headers="Chinstrap ">34</td>
<td class="gt_row gt_right" headers="Gentoo ">61</td>
<td class="gt_row gt_right" headers="All">344</td>
</tr>
<tr class="even">
<td class="gt_row gt_left gt_striped" headers="island"></td>
<td class="gt_row gt_left gt_striped" headers=" ">% row</td>
<td class="gt_row gt_right gt_striped" headers="Adelie">21.2</td>
<td class="gt_row gt_right gt_striped" headers="Chinstrap">9.9</td>
<td class="gt_row gt_right gt_striped" headers="Gentoo">16.9</td>
<td class="gt_row gt_right gt_striped" headers="Adelie ">21.2</td>
<td class="gt_row gt_right gt_striped" headers="Chinstrap ">9.9</td>
<td class="gt_row gt_right gt_striped" headers="Gentoo ">17.7</td>
<td class="gt_row gt_right gt_striped" headers="All">100.0</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Restore default theme:</p>
<div class="cell">
<div class="sourceCode" id="cb14"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/options.html">options</a></span><span class="op">(</span><span class="st">"modelsummary_theme_gt"</span> <span class="op">=</span> <span class="cn">NULL</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<section id="themes-data-frame" class="level2"><h2 class="anchored" data-anchor-id="themes-data-frame">Themes: Data Frame</h2>
<p>A particularly flexible strategy is to apply a theme to the <code>dataframe</code> output format. To illustrate, recall that setting <code>output="dataframe"</code> produces a data frame with a lot of extraneous meta information. To produce a nice table, we have to process that output a bit:</p>
<div class="cell">
<div class="sourceCode" id="cb15"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va">mod</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op">(</span><span class="va">mpg</span> <span class="op">~</span> <span class="va">hp</span> <span class="op">+</span> <span class="va">drat</span>, <span class="va">mtcars</span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">mod</span>, output <span class="op">=</span> <span class="st">"dataframe"</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>        part        term statistic     (1)
1  estimates (Intercept)  estimate  10.790
2  estimates (Intercept) std.error (5.078)
3  estimates          hp  estimate  -0.052
4  estimates          hp std.error (0.009)
5  estimates        drat  estimate   4.698
6  estimates        drat std.error (1.192)
7        gof    Num.Obs.                32
8        gof          R2             0.741
9        gof     R2 Adj.             0.723
10       gof         AIC             169.5
11       gof         BIC             175.4
12       gof    Log.Lik.           -80.752
13       gof           F            41.522
14       gof        RMSE              3.02</code></pre>
</div>
</div>
<p><code>modelsummary</code> supports the <code>DT</code> table-making package out of the box. But for the sake of illustration, imagine we want to create a table using the <code>DT</code> package with specific customization and options, in a repeatable fashion. To do this, we can create a theming function:</p>
<div class="cell">
<div class="sourceCode" id="cb17"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/rstudio/DT">DT</a></span><span class="op">)</span></span>
<span></span>
<span><span class="va">theme_df</span> <span class="op">&lt;-</span> <span class="kw">function</span><span class="op">(</span><span class="va">tab</span><span class="op">)</span> <span class="op">{</span></span>
<span>    <span class="va">out</span> <span class="op">&lt;-</span> <span class="va">tab</span></span>
<span>    <span class="va">out</span><span class="op">$</span><span class="va">term</span><span class="op">[</span><span class="va">out</span><span class="op">$</span><span class="va">statistic</span> <span class="op">==</span> <span class="st">"modelsummary_tmp2"</span><span class="op">]</span> <span class="op">&lt;-</span> <span class="st">" "</span></span>
<span>    <span class="va">out</span><span class="op">$</span><span class="va">part</span> <span class="op">&lt;-</span> <span class="va">out</span><span class="op">$</span><span class="va">statistic</span> <span class="op">&lt;-</span> <span class="cn">NULL</span></span>
<span>    <span class="fu"><a href="https://rdrr.io/r/base/colnames.html">colnames</a></span><span class="op">(</span><span class="va">out</span><span class="op">)</span><span class="op">[</span><span class="fl">1</span><span class="op">]</span> <span class="op">&lt;-</span> <span class="st">" "</span></span>
<span>    <span class="fu"><a href="https://rdrr.io/pkg/DT/man/datatable.html">datatable</a></span><span class="op">(</span><span class="va">out</span>, rownames <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>              options <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>pageLength <span class="op">=</span> <span class="fl">30</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="op">}</span></span>
<span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/options.html">options</a></span><span class="op">(</span><span class="st">"modelsummary_theme_dataframe"</span> <span class="op">=</span> <span class="va">theme_df</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">mod</span>, output <span class="op">=</span> <span class="st">"dataframe"</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div class="datatables html-widget html-fill-item" id="htmlwidget-ece1e06a340c46755a7b" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-ece1e06a340c46755a7b">{"x":{"filter":"none","vertical":false,"data":[["(Intercept)","(Intercept)","hp","hp","drat","drat","Num.Obs.","R2","R2 Adj.","AIC","BIC","Log.Lik.","F","RMSE"],["10.790","(5.078)","-0.052","(0.009)","4.698","(1.192)","32","0.741","0.723","169.5","175.4","-80.752","41.522","3.02"]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>(1)<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"pageLength":30,"columnDefs":[{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"(1)","targets":1}],"order":[],"autoWidth":false,"orderClasses":false,"lengthMenu":[10,25,30,50,100]}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<p>Restore default theme:</p>
<div class="cell">
<div class="sourceCode" id="cb18"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/options.html">options</a></span><span class="op">(</span><span class="st">"modelsummary_theme_dataframe"</span> <span class="op">=</span> <span class="cn">NULL</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section></section><section id="variable-labels" class="level1"><h1>Variable labels</h1>
<p>Some packages like <code>haven</code> can assign attributes to the columns of a dataset for use as labels. Most of the functions in <code>modelsummary</code> can display these labels automatically. For example:</p>
<div class="cell">
<div class="sourceCode" id="cb19"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://haven.tidyverse.org">haven</a></span><span class="op">)</span></span>
<span><span class="va">dat</span> <span class="op">&lt;-</span> <span class="va">mtcars</span></span>
<span><span class="va">dat</span><span class="op">$</span><span class="va">am</span> <span class="op">&lt;-</span> <span class="fu">haven</span><span class="fu">::</span><span class="fu"><a href="https://haven.tidyverse.org/reference/labelled.html">labelled</a></span><span class="op">(</span><span class="va">dat</span><span class="op">$</span><span class="va">am</span>, label <span class="op">=</span> <span class="st">"Transmission"</span><span class="op">)</span></span>
<span><span class="va">dat</span><span class="op">$</span><span class="va">mpg</span> <span class="op">&lt;-</span> <span class="fu">haven</span><span class="fu">::</span><span class="fu"><a href="https://haven.tidyverse.org/reference/labelled.html">labelled</a></span><span class="op">(</span><span class="va">dat</span><span class="op">$</span><span class="va">mpg</span>, label <span class="op">=</span> <span class="st">"Miles per Gallon"</span><span class="op">)</span></span>
<span><span class="va">mod</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op">(</span><span class="va">hp</span> <span class="op">~</span> <span class="va">mpg</span> <span class="op">+</span> <span class="va">am</span>, dat <span class="op">=</span> <span class="va">dat</span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">mod</span>, coef_rename <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<!-- preamble start -->

    <script>

      function styleCell_wa1tublts1f8o5yojjin(i, j, css_id) {
          var table = document.getElementById("tinytable_wa1tublts1f8o5yojjin");
          var cell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
          if (cell) {
              console.log(`Styling cell at (${i}, ${j}) with class ${css_id}`);
              cell.classList.add(css_id);
          } else {
              console.warn(`Cell at (${i}, ${j}) not found.`);
          }
      }
      function spanCell_wa1tublts1f8o5yojjin(i, j, rowspan, colspan) {
        var table = document.getElementById("tinytable_wa1tublts1f8o5yojjin");
        const targetCell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
        if (!targetCell) {
          console.warn(`Cell at (${i}, ${j}) not found.`);
        }

        // Get all cells that need to be removed
        const cellsToRemove = [];
        for (let r = 0; r < rowspan; r++) {
          for (let c = 0; c < colspan; c++) {
            if (r === 0 && c === 0) continue; // Skip the target cell
            const cell = table.querySelector(`[data-row="${i + r}"][data-col="${j + c}"]`);
            if (cell) {
              cellsToRemove.push(cell);
            }
          }
        }

        // Remove all cells
        cellsToRemove.forEach(cell => cell.remove());

        // Set rowspan and colspan of the target cell if it exists
        if (targetCell) {
          targetCell.rowSpan = rowspan;
          targetCell.colSpan = colspan;
        }
      }
      // tinytable span after
      window.addEventListener('load', function () {
          var cellsToStyle = [
            // tinytable style arrays after
          { positions: [ { i: '14', j: 1 },  ], css_id: 'tinytable_css_ehxznn8ur5pzv64ut1oh',}, 
          { positions: [ { i: '6', j: 1 },  ], css_id: 'tinytable_css_4xrikbfquj6l5toqx63v',}, 
          { positions: [ { i: '1', j: 1 }, { i: '2', j: 1 }, { i: '3', j: 1 }, { i: '4', j: 1 }, { i: '5', j: 1 }, { i: '10', j: 1 }, { i: '7', j: 1 }, { i: '8', j: 1 }, { i: '9', j: 1 }, { i: '11', j: 1 }, { i: '12', j: 1 }, { i: '13', j: 1 },  ], css_id: 'tinytable_css_6l21k774y65wf9xuyn47',}, 
          { positions: [ { i: '0', j: 1 },  ], css_id: 'tinytable_css_mrt1mznnspohjkhnu8dk',}, 
          { positions: [ { i: '14', j: 0 },  ], css_id: 'tinytable_css_20ebdrwcjaasa1h45ws0',}, 
          { positions: [ { i: '6', j: 0 },  ], css_id: 'tinytable_css_2cf2alcq5s07yg4yzsbz',}, 
          { positions: [ { i: '1', j: 0 }, { i: '2', j: 0 }, { i: '3', j: 0 }, { i: '4', j: 0 }, { i: '5', j: 0 }, { i: '10', j: 0 }, { i: '7', j: 0 }, { i: '8', j: 0 }, { i: '9', j: 0 }, { i: '11', j: 0 }, { i: '12', j: 0 }, { i: '13', j: 0 },  ], css_id: 'tinytable_css_4s9wezi1q4tcvp2indhq',}, 
          { positions: [ { i: '0', j: 0 },  ], css_id: 'tinytable_css_z9ct8s18h1fkypiaxnn0',}, 
          ];

          // Loop over the arrays to style the cells
          cellsToStyle.forEach(function (group) {
              group.positions.forEach(function (cell) {
                  styleCell_wa1tublts1f8o5yojjin(cell.i, cell.j, group.css_id);
              });
          });
      });
    </script><style>
      /* tinytable css entries after */
      .table td.tinytable_css_ehxznn8ur5pzv64ut1oh, .table th.tinytable_css_ehxznn8ur5pzv64ut1oh { text-align: center; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_4xrikbfquj6l5toqx63v, .table th.tinytable_css_4xrikbfquj6l5toqx63v { text-align: center; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_6l21k774y65wf9xuyn47, .table th.tinytable_css_6l21k774y65wf9xuyn47 { text-align: center; }
      .table td.tinytable_css_mrt1mznnspohjkhnu8dk, .table th.tinytable_css_mrt1mznnspohjkhnu8dk { text-align: center; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
      .table td.tinytable_css_20ebdrwcjaasa1h45ws0, .table th.tinytable_css_20ebdrwcjaasa1h45ws0 { text-align: left; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_2cf2alcq5s07yg4yzsbz, .table th.tinytable_css_2cf2alcq5s07yg4yzsbz { text-align: left; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_4s9wezi1q4tcvp2indhq, .table th.tinytable_css_4s9wezi1q4tcvp2indhq { text-align: left; }
      .table td.tinytable_css_z9ct8s18h1fkypiaxnn0, .table th.tinytable_css_z9ct8s18h1fkypiaxnn0 { text-align: left; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
    </style>
<div class="container">
      <table class="table table-borderless" id="tinytable_wa1tublts1f8o5yojjin" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing="true">
<thead><tr>
<th scope="col" data-row="0" data-col="0"> </th>
                <th scope="col" data-row="0" data-col="1">(1)</th>
              </tr></thead>
<tbody>
<tr>
<td data-row="1" data-col="0">(Intercept)</td>
                  <td data-row="1" data-col="1">352.312</td>
                </tr>
<tr>
<td data-row="2" data-col="0"></td>
                  <td data-row="2" data-col="1">(27.226)</td>
                </tr>
<tr>
<td data-row="3" data-col="0">Miles per Gallon</td>
                  <td data-row="3" data-col="1">-11.200</td>
                </tr>
<tr>
<td data-row="4" data-col="0"></td>
                  <td data-row="4" data-col="1">(1.494)</td>
                </tr>
<tr>
<td data-row="5" data-col="0">Transmission</td>
                  <td data-row="5" data-col="1">47.725</td>
                </tr>
<tr>
<td data-row="6" data-col="0"></td>
                  <td data-row="6" data-col="1">(18.048)</td>
                </tr>
<tr>
<td data-row="7" data-col="0">Num.Obs.</td>
                  <td data-row="7" data-col="1">32</td>
                </tr>
<tr>
<td data-row="8" data-col="0">R2</td>
                  <td data-row="8" data-col="1">0.680</td>
                </tr>
<tr>
<td data-row="9" data-col="0">R2 Adj.</td>
                  <td data-row="9" data-col="1">0.658</td>
                </tr>
<tr>
<td data-row="10" data-col="0">AIC</td>
                  <td data-row="10" data-col="1">331.9</td>
                </tr>
<tr>
<td data-row="11" data-col="0">BIC</td>
                  <td data-row="11" data-col="1">337.8</td>
                </tr>
<tr>
<td data-row="12" data-col="0">Log.Lik.</td>
                  <td data-row="12" data-col="1">-161.971</td>
                </tr>
<tr>
<td data-row="13" data-col="0">F</td>
                  <td data-row="13" data-col="1">30.766</td>
                </tr>
<tr>
<td data-row="14" data-col="0">RMSE</td>
                  <td data-row="14" data-col="1">38.19</td>
                </tr>
</tbody>
</table>
</div>
<!-- hack to avoid NA insertion in last line -->
</div>
<div class="sourceCode" id="cb20"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu"><a href="https://modelsummary.com/man/datasummary_skim.html">datasummary_skim</a></span><span class="op">(</span><span class="va">dat</span><span class="op">[</span>, <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"mpg"</span>, <span class="st">"am"</span>, <span class="st">"drat"</span><span class="op">)</span><span class="op">]</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<!-- preamble start -->

    <script>

      function styleCell_zlaz8oiv3m4cv7zmmmzj(i, j, css_id) {
          var table = document.getElementById("tinytable_zlaz8oiv3m4cv7zmmmzj");
          var cell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
          if (cell) {
              console.log(`Styling cell at (${i}, ${j}) with class ${css_id}`);
              cell.classList.add(css_id);
          } else {
              console.warn(`Cell at (${i}, ${j}) not found.`);
          }
      }
      function spanCell_zlaz8oiv3m4cv7zmmmzj(i, j, rowspan, colspan) {
        var table = document.getElementById("tinytable_zlaz8oiv3m4cv7zmmmzj");
        const targetCell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
        if (!targetCell) {
          console.warn(`Cell at (${i}, ${j}) not found.`);
        }

        // Get all cells that need to be removed
        const cellsToRemove = [];
        for (let r = 0; r < rowspan; r++) {
          for (let c = 0; c < colspan; c++) {
            if (r === 0 && c === 0) continue; // Skip the target cell
            const cell = table.querySelector(`[data-row="${i + r}"][data-col="${j + c}"]`);
            if (cell) {
              cellsToRemove.push(cell);
            }
          }
        }

        // Remove all cells
        cellsToRemove.forEach(cell => cell.remove());

        // Set rowspan and colspan of the target cell if it exists
        if (targetCell) {
          targetCell.rowSpan = rowspan;
          targetCell.colSpan = colspan;
        }
      }
      // tinytable span after
      window.addEventListener('load', function () {
          var cellsToStyle = [
            // tinytable style arrays after
          { positions: [ { i: '3', j: 5 }, { i: '3', j: 2 }, { i: '3', j: 6 }, { i: '3', j: 3 }, { i: '3', j: 0 }, { i: '3', j: 7 }, { i: '3', j: 4 }, { i: '3', j: 1 }, { i: '3', j: 8 },  ], css_id: 'tinytable_css_sbcwpjun45yjgkjl5ek3',}, 
          { positions: [ { i: '1', j: 0 }, { i: '1', j: 1 }, { i: '1', j: 2 }, { i: '2', j: 2 }, { i: '1', j: 3 }, { i: '2', j: 3 }, { i: '2', j: 0 }, { i: '1', j: 7 }, { i: '1', j: 4 }, { i: '2', j: 4 }, { i: '2', j: 1 }, { i: '1', j: 8 }, { i: '1', j: 5 }, { i: '2', j: 5 }, { i: '1', j: 6 }, { i: '2', j: 6 }, { i: '2', j: 7 }, { i: '2', j: 8 },  ], css_id: 'tinytable_css_3m3mvqmorhyvg9ezuuxa',}, 
          { positions: [ { i: '0', j: 0 }, { i: '0', j: 7 }, { i: '0', j: 4 }, { i: '0', j: 1 }, { i: '0', j: 8 }, { i: '0', j: 5 }, { i: '0', j: 2 }, { i: '0', j: 6 }, { i: '0', j: 3 },  ], css_id: 'tinytable_css_er635c94baerf79fu23e',}, 
          ];

          // Loop over the arrays to style the cells
          cellsToStyle.forEach(function (group) {
              group.positions.forEach(function (cell) {
                  styleCell_zlaz8oiv3m4cv7zmmmzj(cell.i, cell.j, group.css_id);
              });
          });
      });
    </script><style>
      /* tinytable css entries after */
      .table td.tinytable_css_sbcwpjun45yjgkjl5ek3, .table th.tinytable_css_sbcwpjun45yjgkjl5ek3 { text-align: left; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_3m3mvqmorhyvg9ezuuxa, .table th.tinytable_css_3m3mvqmorhyvg9ezuuxa { text-align: left; }
      .table td.tinytable_css_er635c94baerf79fu23e, .table th.tinytable_css_er635c94baerf79fu23e { text-align: left; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
    </style>
<div class="container">
      <table class="table table-borderless" id="tinytable_zlaz8oiv3m4cv7zmmmzj" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing="true">
<thead><tr>
<th scope="col" data-row="0" data-col="0"> </th>
                <th scope="col" data-row="0" data-col="1">Unique</th>
                <th scope="col" data-row="0" data-col="2">Missing Pct.</th>
                <th scope="col" data-row="0" data-col="3">Mean</th>
                <th scope="col" data-row="0" data-col="4">SD</th>
                <th scope="col" data-row="0" data-col="5">Min</th>
                <th scope="col" data-row="0" data-col="6">Median</th>
                <th scope="col" data-row="0" data-col="7">Max</th>
                <th scope="col" data-row="0" data-col="8">Histogram</th>
              </tr></thead>
<tbody>
<tr>
<td data-row="1" data-col="0">Miles per Gallon</td>
                  <td data-row="1" data-col="1">25</td>
                  <td data-row="1" data-col="2">0</td>
                  <td data-row="1" data-col="3">20.1</td>
                  <td data-row="1" data-col="4">6.0</td>
                  <td data-row="1" data-col="5">10.4</td>
                  <td data-row="1" data-col="6">19.2</td>
                  <td data-row="1" data-col="7">33.9</td>
                  <td data-row="1" data-col="8"><img src="./tinytable_assets/idlmuya0jo2b5g7a3me99q.png" style="height: 1em;"></td>
                </tr>
<tr>
<td data-row="2" data-col="0">Transmission</td>
                  <td data-row="2" data-col="1">2</td>
                  <td data-row="2" data-col="2">0</td>
                  <td data-row="2" data-col="3">0.4</td>
                  <td data-row="2" data-col="4">0.5</td>
                  <td data-row="2" data-col="5">0.0</td>
                  <td data-row="2" data-col="6">0.0</td>
                  <td data-row="2" data-col="7">1.0</td>
                  <td data-row="2" data-col="8"><img src="./tinytable_assets/idz5pbswzmtamyttgqmq13.png" style="height: 1em;"></td>
                </tr>
<tr>
<td data-row="3" data-col="0">drat</td>
                  <td data-row="3" data-col="1">22</td>
                  <td data-row="3" data-col="2">0</td>
                  <td data-row="3" data-col="3">3.6</td>
                  <td data-row="3" data-col="4">0.5</td>
                  <td data-row="3" data-col="5">2.8</td>
                  <td data-row="3" data-col="6">3.7</td>
                  <td data-row="3" data-col="7">4.9</td>
                  <td data-row="3" data-col="8"><img src="./tinytable_assets/idzx482ygj78rcgp7djoi2.png" style="height: 1em;"></td>
                </tr>
</tbody>
</table>
</div>
<!-- hack to avoid NA insertion in last line -->
</div>
</div>
</section><section id="warning-saving-to-file" class="level1"><h1>Warning: Saving to file</h1>
<p>When users supply a file name to the <code>output</code> argument, the table is written immediately to file. This means that users cannot post-process and customize the resulting table using functions from <code>gt</code>, <code>kableExtra</code>, <code>huxtable</code>, or <code>flextable</code>. When users specify a filename in the <code>output</code> argument, the <code><a href="https://modelsummary.com/man/modelsummary.html">modelsummary()</a></code> call should be the <em>final</em> one in the chain.</p>
<p>This is OK:</p>
<div class="cell">
<div class="sourceCode" id="cb21"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">models</span>, output <span class="op">=</span> <span class="st">'table.html'</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>This is <strong>not</strong> OK:</p>
<div class="cell">
<div class="sourceCode" id="cb22"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://vincentarelbundock.github.io/tinytable/">tinytable</a></span><span class="op">)</span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">models</span>, output <span class="op">=</span> <span class="st">'table.html'</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span>    <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/group_tt.html">group_tt</a></span><span class="op">(</span>j <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>Literacy <span class="op">=</span> <span class="fl">2</span><span class="op">:</span><span class="fl">3</span><span class="op">)</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>To save a customized table, you should apply all the customizations you need before saving it using dedicated package-specific functions:</p>
<ul>
<li><code><a href="https://vincentarelbundock.github.io/tinytable/man/save_tt.html">tinytable::save_tt()</a></code></li>
<li><code><a href="https://gt.rstudio.com/reference/gtsave.html">gt::gtsave()</a></code></li>
<li><code><a href="https://rdrr.io/pkg/kableExtra/man/save_kable.html">kableExtra::save_kable()</a></code></li>
</ul>
<p>For example, to add color column spanners with the <code>gt</code> package:</p>
<div class="cell">
<div class="sourceCode" id="cb23"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://vincentarelbundock.github.io/tinytable/">tinytable</a></span><span class="op">)</span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">models</span>, output <span class="op">=</span> <span class="st">'tinytable'</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span>    <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/group_tt.html">group_tt</a></span><span class="op">(</span>j <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>Literacy <span class="op">=</span> <span class="fl">2</span><span class="op">:</span><span class="fl">3</span><span class="op">)</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span>    <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/save_tt.html">save_tt</a></span><span class="op">(</span><span class="st">"table.html"</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<section id="latex-significance-stars" class="level2"><h2 class="anchored" data-anchor-id="latex-significance-stars">LaTeX significance stars</h2>
<p>When rendering a notebook to PDF or saving a table to LaTeX, <code>modelsummary</code> will automatically wrap the stars identifiers in the footnote in a <code>siunitx</code> <code>\num{}</code> tag. This ensures proper rendering. Unfortunately, when saving the table to file using <code><a href="https://vincentarelbundock.github.io/tinytable/man/save_tt.html">save_tt()</a></code>, <code>modelsummary</code> does not know <em>ex ante</em> what the ultimate file format will be, so it cannot automatically wrap the stars.</p>
<p>One alternative is to turn off the stars footnote using a global option, and then supply the stars indicators manually in the <code>notes</code> argument.</p>
<div class="sourceCode" id="cb24"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://vincentarelbundock.github.io/tinytable/">tinytable</a></span><span class="op">)</span></span>
<span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://modelsummary.com">modelsummary</a></span><span class="op">)</span></span>
<span><span class="va">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/Normal.html">rnorm</a></span><span class="op">(</span><span class="fl">1e6</span><span class="op">)</span></span>
<span><span class="va">y</span> <span class="op">&lt;-</span> <span class="va">x</span> <span class="op">+</span> <span class="fu"><a href="https://rdrr.io/r/stats/Normal.html">rnorm</a></span><span class="op">(</span><span class="fl">1e6</span><span class="op">)</span></span>
<span><span class="va">m</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op">(</span><span class="va">y</span> <span class="op">~</span> <span class="va">x</span><span class="op">)</span></span>
<span><span class="va">sn</span> <span class="op">&lt;-</span> <span class="st">"+ \\num{&lt; 0.1}, * \\num{p&lt; 0.05}, ** \\num{p&lt;0.01}, *** \\num{p&lt;0.001}"</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/options.html">options</a></span><span class="op">(</span>modelsummary_stars_note <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">m</span>, notes <span class="op">=</span> <span class="va">sn</span>, stars <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span> <span class="op">|&gt;</span> <span class="fu"><a href="https://vincentarelbundock.github.io/tinytable/man/save_tt.html">save_tt</a></span><span class="op">(</span><span class="st">"latex"</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</section><section id="math" class="level2"><h2 class="anchored" data-anchor-id="math">Math</h2>
<p>To render math in <code>modelsummary</code> in HTML files, you need to ensure that MathJax is enabled. See the <a href="https://vincentarelbundock.github.io/tinytable/vignettes/format.html#math"><code>tinytable</code> documentation for more details.</a></p>
<p>Here is a minimal example:</p>
<div class="cell">
<div class="sourceCode" id="cb25"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/options.html">options</a></span><span class="op">(</span>tinytable_html_mathjax <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span>
<span><span class="va">mod</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op">(</span><span class="va">mpg</span> <span class="op">~</span> <span class="fu"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op">(</span><span class="va">cyl</span><span class="op">)</span> <span class="op">-</span> <span class="fl">1</span>, data <span class="op">=</span> <span class="va">mtcars</span><span class="op">)</span></span>
<span><span class="va">cr</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"factor(cyl)4"</span> <span class="op">=</span> <span class="st">"$\\beta_1$"</span>, <span class="st">"factor(cyl)6"</span> <span class="op">=</span> <span class="st">"$\\beta_2$"</span>, <span class="st">"factor(cyl)8"</span> <span class="op">=</span> <span class="st">"$\\beta_3$"</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://modelsummary.com/man/modelsummary.html">modelsummary</a></span><span class="op">(</span><span class="va">mod</span>, coef_map <span class="op">=</span> <span class="va">cr</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<!-- preamble start -->

    <!-- tinytable mathjax start -->
    <script id="MathJax-script" async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script><script>
    MathJax = {
      tex: {
        inlineMath: [['$', '$'], ['\\(', '\\)']]
      },
      svg: {
        fontCache: 'global'
      }
    };
    </script><!-- tinytable mathjax end --><script>

      function styleCell_4y60onrub07405o7xovg(i, j, css_id) {
          var table = document.getElementById("tinytable_4y60onrub07405o7xovg");
          var cell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
          if (cell) {
              console.log(`Styling cell at (${i}, ${j}) with class ${css_id}`);
              cell.classList.add(css_id);
          } else {
              console.warn(`Cell at (${i}, ${j}) not found.`);
          }
      }
      function spanCell_4y60onrub07405o7xovg(i, j, rowspan, colspan) {
        var table = document.getElementById("tinytable_4y60onrub07405o7xovg");
        const targetCell = table.querySelector(`[data-row="${i}"][data-col="${j}"]`);
        if (!targetCell) {
          console.warn(`Cell at (${i}, ${j}) not found.`);
        }

        // Get all cells that need to be removed
        const cellsToRemove = [];
        for (let r = 0; r < rowspan; r++) {
          for (let c = 0; c < colspan; c++) {
            if (r === 0 && c === 0) continue; // Skip the target cell
            const cell = table.querySelector(`[data-row="${i + r}"][data-col="${j + c}"]`);
            if (cell) {
              cellsToRemove.push(cell);
            }
          }
        }

        // Remove all cells
        cellsToRemove.forEach(cell => cell.remove());

        // Set rowspan and colspan of the target cell if it exists
        if (targetCell) {
          targetCell.rowSpan = rowspan;
          targetCell.colSpan = colspan;
        }
      }
      // tinytable span after
      window.addEventListener('load', function () {
          var cellsToStyle = [
            // tinytable style arrays after
          { positions: [ { i: '13', j: 1 },  ], css_id: 'tinytable_css_qolnucuz7vvxtnq4vw7e',}, 
          { positions: [ { i: '6', j: 1 },  ], css_id: 'tinytable_css_nie3831dfz6uc9oy6wtj',}, 
          { positions: [ { i: '1', j: 1 }, { i: '2', j: 1 }, { i: '3', j: 1 }, { i: '4', j: 1 }, { i: '5', j: 1 }, { i: '10', j: 1 }, { i: '7', j: 1 }, { i: '8', j: 1 }, { i: '9', j: 1 }, { i: '11', j: 1 }, { i: '12', j: 1 },  ], css_id: 'tinytable_css_vjmnt0ptrl4seb4n0mtb',}, 
          { positions: [ { i: '0', j: 1 },  ], css_id: 'tinytable_css_7wuwy0ewjdmkw2b3x9l0',}, 
          { positions: [ { i: '13', j: 0 },  ], css_id: 'tinytable_css_gwvgslrkwsnfui906752',}, 
          { positions: [ { i: '6', j: 0 },  ], css_id: 'tinytable_css_rdawbhedoddperd4m3x8',}, 
          { positions: [ { i: '1', j: 0 }, { i: '2', j: 0 }, { i: '3', j: 0 }, { i: '4', j: 0 }, { i: '5', j: 0 }, { i: '10', j: 0 }, { i: '7', j: 0 }, { i: '8', j: 0 }, { i: '9', j: 0 }, { i: '11', j: 0 }, { i: '12', j: 0 },  ], css_id: 'tinytable_css_7srbafzjcthz9turzdpm',}, 
          { positions: [ { i: '0', j: 0 },  ], css_id: 'tinytable_css_rqhy25v6vvpz9w99zuv3',}, 
          ];

          // Loop over the arrays to style the cells
          cellsToStyle.forEach(function (group) {
              group.positions.forEach(function (cell) {
                  styleCell_4y60onrub07405o7xovg(cell.i, cell.j, group.css_id);
              });
          });
      });
    </script><style>
      /* tinytable css entries after */
      .table td.tinytable_css_qolnucuz7vvxtnq4vw7e, .table th.tinytable_css_qolnucuz7vvxtnq4vw7e { text-align: center; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_nie3831dfz6uc9oy6wtj, .table th.tinytable_css_nie3831dfz6uc9oy6wtj { text-align: center; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_vjmnt0ptrl4seb4n0mtb, .table th.tinytable_css_vjmnt0ptrl4seb4n0mtb { text-align: center; }
      .table td.tinytable_css_7wuwy0ewjdmkw2b3x9l0, .table th.tinytable_css_7wuwy0ewjdmkw2b3x9l0 { text-align: center; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
      .table td.tinytable_css_gwvgslrkwsnfui906752, .table th.tinytable_css_gwvgslrkwsnfui906752 { text-align: left; border-bottom: solid #d3d8dc 0.1em; }
      .table td.tinytable_css_rdawbhedoddperd4m3x8, .table th.tinytable_css_rdawbhedoddperd4m3x8 { text-align: left; border-bottom: solid black 0.05em; }
      .table td.tinytable_css_7srbafzjcthz9turzdpm, .table th.tinytable_css_7srbafzjcthz9turzdpm { text-align: left; }
      .table td.tinytable_css_rqhy25v6vvpz9w99zuv3, .table th.tinytable_css_rqhy25v6vvpz9w99zuv3 { text-align: left; border-top: solid #d3d8dc 0.1em; border-bottom: solid #d3d8dc 0.05em; }
    </style>
<div class="container">
      <table class="table table-borderless" id="tinytable_4y60onrub07405o7xovg" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing="true">
<thead><tr>
<th scope="col" data-row="0" data-col="0"> </th>
                <th scope="col" data-row="0" data-col="1">(1)</th>
              </tr></thead>
<tbody>
<tr>
<td data-row="1" data-col="0">$\beta_1$</td>
                  <td data-row="1" data-col="1">26.664</td>
                </tr>
<tr>
<td data-row="2" data-col="0"></td>
                  <td data-row="2" data-col="1">(0.972)</td>
                </tr>
<tr>
<td data-row="3" data-col="0">$\beta_2$</td>
                  <td data-row="3" data-col="1">19.743</td>
                </tr>
<tr>
<td data-row="4" data-col="0"></td>
                  <td data-row="4" data-col="1">(1.218)</td>
                </tr>
<tr>
<td data-row="5" data-col="0">$\beta_3$</td>
                  <td data-row="5" data-col="1">15.100</td>
                </tr>
<tr>
<td data-row="6" data-col="0"></td>
                  <td data-row="6" data-col="1">(0.861)</td>
                </tr>
<tr>
<td data-row="7" data-col="0">Num.Obs.</td>
                  <td data-row="7" data-col="1">32</td>
                </tr>
<tr>
<td data-row="8" data-col="0">R2</td>
                  <td data-row="8" data-col="1">0.979</td>
                </tr>
<tr>
<td data-row="9" data-col="0">R2 Adj.</td>
                  <td data-row="9" data-col="1">0.976</td>
                </tr>
<tr>
<td data-row="10" data-col="0">AIC</td>
                  <td data-row="10" data-col="1">170.6</td>
                </tr>
<tr>
<td data-row="11" data-col="0">BIC</td>
                  <td data-row="11" data-col="1">176.4</td>
                </tr>
<tr>
<td data-row="12" data-col="0">Log.Lik.</td>
                  <td data-row="12" data-col="1">-81.282</td>
                </tr>
<tr>
<td data-row="13" data-col="0">RMSE</td>
                  <td data-row="13" data-col="1">3.07</td>
                </tr>
</tbody>
</table>
</div>
<!-- hack to avoid NA insertion in last line -->
</div>
</div>


</section></section></main><!-- /main --><script id="quarto-html-after-body" type="application/javascript">
  window.document.addEventListener("DOMContentLoaded", function (event) {
    const icon = "";
    const anchorJS = new window.AnchorJS();
    anchorJS.options = {
      placement: 'right',
      icon: icon
    };
    anchorJS.add('.anchored');
    const isCodeAnnotation = (el) => {
      for (const clz of el.classList) {
        if (clz.startsWith('code-annotation-')) {                     
          return true;
        }
      }
      return false;
    }
    const onCopySuccess = function(e) {
      // button target
      const button = e.trigger;
      // don't keep focus
      button.blur();
      // flash "checked"
      button.classList.add('code-copy-button-checked');
      var currentTitle = button.getAttribute("title");
      button.setAttribute("title", "Copied!");
      let tooltip;
      if (window.bootstrap) {
        button.setAttribute("data-bs-toggle", "tooltip");
        button.setAttribute("data-bs-placement", "left");
        button.setAttribute("data-bs-title", "Copied!");
        tooltip = new bootstrap.Tooltip(button, 
          { trigger: "manual", 
            customClass: "code-copy-button-tooltip",
            offset: [0, -8]});
        tooltip.show();    
      }
      setTimeout(function() {
        if (tooltip) {
          tooltip.hide();
          button.removeAttribute("data-bs-title");
          button.removeAttribute("data-bs-toggle");
          button.removeAttribute("data-bs-placement");
        }
        button.setAttribute("title", currentTitle);
        button.classList.remove('code-copy-button-checked');
      }, 1000);
      // clear code selection
      e.clearSelection();
    }
    const getTextToCopy = function(trigger) {
        const codeEl = trigger.previousElementSibling.cloneNode(true);
        for (const childEl of codeEl.children) {
          if (isCodeAnnotation(childEl)) {
            childEl.remove();
          }
        }
        return codeEl.innerText;
    }
    const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
      text: getTextToCopy
    });
    clipboard.on('success', onCopySuccess);
    if (window.document.getElementById('quarto-embedded-source-code-modal')) {
      const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
        text: getTextToCopy,
        container: window.document.getElementById('quarto-embedded-source-code-modal')
      });
      clipboardModal.on('success', onCopySuccess);
    }
      var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
      var mailtoRegex = new RegExp(/^mailto:/);
        var filterRegex = new RegExp('/' + window.location.host + '/');
      var isInternal = (href) => {
          return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
      }
      // Inspect non-navigation links and adorn them if external
     var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)');
      for (var i=0; i<links.length; i++) {
        const link = links[i];
        if (!isInternal(link.href)) {
          // undo the damage that might have been done by quarto-nav.js in the case of
          // links that we want to consider external
          if (link.dataset.originalHref !== undefined) {
            link.href = link.dataset.originalHref;
          }
        }
      }
    function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
      const config = {
        allowHTML: true,
        maxWidth: 500,
        delay: 100,
        arrow: false,
        appendTo: function(el) {
            return el.parentElement;
        },
        interactive: true,
        interactiveBorder: 10,
        theme: 'quarto',
        placement: 'bottom-start',
      };
      if (contentFn) {
        config.content = contentFn;
      }
      if (onTriggerFn) {
        config.onTrigger = onTriggerFn;
      }
      if (onUntriggerFn) {
        config.onUntrigger = onUntriggerFn;
      }
      window.tippy(el, config); 
    }
    const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
    for (var i=0; i<noterefs.length; i++) {
      const ref = noterefs[i];
      tippyHover(ref, function() {
        // use id or data attribute instead here
        let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
        try { href = new URL(href).hash; } catch {}
        const id = href.replace(/^#\/?/, "");
        const note = window.document.getElementById(id);
        if (note) {
          return note.innerHTML;
        } else {
          return "";
        }
      });
    }
    const xrefs = window.document.querySelectorAll('a.quarto-xref');
    const processXRef = (id, note) => {
      // Strip column container classes
      const stripColumnClz = (el) => {
        el.classList.remove("page-full", "page-columns");
        if (el.children) {
          for (const child of el.children) {
            stripColumnClz(child);
          }
        }
      }
      stripColumnClz(note)
      if (id === null || id.startsWith('sec-')) {
        // Special case sections, only their first couple elements
        const container = document.createElement("div");
        if (note.children && note.children.length > 2) {
          container.appendChild(note.children[0].cloneNode(true));
          for (let i = 1; i < note.children.length; i++) {
            const child = note.children[i];
            if (child.tagName === "P" && child.innerText === "") {
              continue;
            } else {
              container.appendChild(child.cloneNode(true));
              break;
            }
          }
          if (window.Quarto?.typesetMath) {
            window.Quarto.typesetMath(container);
          }
          return container.innerHTML
        } else {
          if (window.Quarto?.typesetMath) {
            window.Quarto.typesetMath(note);
          }
          return note.innerHTML;
        }
      } else {
        // Remove any anchor links if they are present
        const anchorLink = note.querySelector('a.anchorjs-link');
        if (anchorLink) {
          anchorLink.remove();
        }
        if (window.Quarto?.typesetMath) {
          window.Quarto.typesetMath(note);
        }
        if (note.classList.contains("callout")) {
          return note.outerHTML;
        } else {
          return note.innerHTML;
        }
      }
    }
    for (var i=0; i<xrefs.length; i++) {
      const xref = xrefs[i];
      tippyHover(xref, undefined, function(instance) {
        instance.disable();
        let url = xref.getAttribute('href');
        let hash = undefined; 
        if (url.startsWith('#')) {
          hash = url;
        } else {
          try { hash = new URL(url).hash; } catch {}
        }
        if (hash) {
          const id = hash.replace(/^#\/?/, "");
          const note = window.document.getElementById(id);
          if (note !== null) {
            try {
              const html = processXRef(id, note.cloneNode(true));
              instance.setContent(html);
            } finally {
              instance.enable();
              instance.show();
            }
          } else {
            // See if we can fetch this
            fetch(url.split('#')[0])
            .then(res => res.text())
            .then(html => {
              const parser = new DOMParser();
              const htmlDoc = parser.parseFromString(html, "text/html");
              const note = htmlDoc.getElementById(id);
              if (note !== null) {
                const html = processXRef(id, note);
                instance.setContent(html);
              } 
            }).finally(() => {
              instance.enable();
              instance.show();
            });
          }
        } else {
          // See if we can fetch a full url (with no hash to target)
          // This is a special case and we should probably do some content thinning / targeting
          fetch(url)
          .then(res => res.text())
          .then(html => {
            const parser = new DOMParser();
            const htmlDoc = parser.parseFromString(html, "text/html");
            const note = htmlDoc.querySelector('main.content');
            if (note !== null) {
              // This should only happen for chapter cross references
              // (since there is no id in the URL)
              // remove the first header
              if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
                note.children[0].remove();
              }
              const html = processXRef(null, note);
              instance.setContent(html);
            } 
          }).finally(() => {
            instance.enable();
            instance.show();
          });
        }
      }, function(instance) {
      });
    }
        let selectedAnnoteEl;
        const selectorForAnnotation = ( cell, annotation) => {
          let cellAttr = 'data-code-cell="' + cell + '"';
          let lineAttr = 'data-code-annotation="' +  annotation + '"';
          const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
          return selector;
        }
        const selectCodeLines = (annoteEl) => {
          const doc = window.document;
          const targetCell = annoteEl.getAttribute("data-target-cell");
          const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
          const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
          const lines = annoteSpan.getAttribute("data-code-lines").split(",");
          const lineIds = lines.map((line) => {
            return targetCell + "-" + line;
          })
          let top = null;
          let height = null;
          let parent = null;
          if (lineIds.length > 0) {
              //compute the position of the single el (top and bottom and make a div)
              const el = window.document.getElementById(lineIds[0]);
              top = el.offsetTop;
              height = el.offsetHeight;
              parent = el.parentElement.parentElement;
            if (lineIds.length > 1) {
              const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
              const bottom = lastEl.offsetTop + lastEl.offsetHeight;
              height = bottom - top;
            }
            if (top !== null && height !== null && parent !== null) {
              // cook up a div (if necessary) and position it 
              let div = window.document.getElementById("code-annotation-line-highlight");
              if (div === null) {
                div = window.document.createElement("div");
                div.setAttribute("id", "code-annotation-line-highlight");
                div.style.position = 'absolute';
                parent.appendChild(div);
              }
              div.style.top = top - 2 + "px";
              div.style.height = height + 4 + "px";
              div.style.left = 0;
              let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
              if (gutterDiv === null) {
                gutterDiv = window.document.createElement("div");
                gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
                gutterDiv.style.position = 'absolute';
                const codeCell = window.document.getElementById(targetCell);
                const gutter = codeCell.querySelector('.code-annotation-gutter');
                gutter.appendChild(gutterDiv);
              }
              gutterDiv.style.top = top - 2 + "px";
              gutterDiv.style.height = height + 4 + "px";
            }
            selectedAnnoteEl = annoteEl;
          }
        };
        const unselectCodeLines = () => {
          const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
          elementsIds.forEach((elId) => {
            const div = window.document.getElementById(elId);
            if (div) {
              div.remove();
            }
          });
          selectedAnnoteEl = undefined;
        };
          // Handle positioning of the toggle
      window.addEventListener(
        "resize",
        throttle(() => {
          elRect = undefined;
          if (selectedAnnoteEl) {
            selectCodeLines(selectedAnnoteEl);
          }
        }, 10)
      );
      function throttle(fn, ms) {
      let throttle = false;
      let timer;
        return (...args) => {
          if(!throttle) { // first call gets through
              fn.apply(this, args);
              throttle = true;
          } else { // all the others get throttled
              if(timer) clearTimeout(timer); // cancel #2
              timer = setTimeout(() => {
                fn.apply(this, args);
                timer = throttle = false;
              }, ms);
          }
        };
      }
        // Attach click handler to the DT
        const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
        for (const annoteDlNode of annoteDls) {
          annoteDlNode.addEventListener('click', (event) => {
            const clickedEl = event.target;
            if (clickedEl !== selectedAnnoteEl) {
              unselectCodeLines();
              const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
              if (activeEl) {
                activeEl.classList.remove('code-annotation-active');
              }
              selectCodeLines(clickedEl);
              clickedEl.classList.add('code-annotation-active');
            } else {
              // Unselect the line
              unselectCodeLines();
              clickedEl.classList.remove('code-annotation-active');
            }
          });
        }
    const findCites = (el) => {
      const parentEl = el.parentElement;
      if (parentEl) {
        const cites = parentEl.dataset.cites;
        if (cites) {
          return {
            el,
            cites: cites.split(' ')
          };
        } else {
          return findCites(el.parentElement)
        }
      } else {
        return undefined;
      }
    };
    var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
    for (var i=0; i<bibliorefs.length; i++) {
      const ref = bibliorefs[i];
      const citeInfo = findCites(ref);
      if (citeInfo) {
        tippyHover(citeInfo.el, function() {
          var popup = window.document.createElement('div');
          citeInfo.cites.forEach(function(cite) {
            var citeDiv = window.document.createElement('div');
            citeDiv.classList.add('hanging-indent');
            citeDiv.classList.add('csl-entry');
            var biblioDiv = window.document.getElementById('ref-' + cite);
            if (biblioDiv) {
              citeDiv.innerHTML = biblioDiv.innerHTML;
            }
            popup.appendChild(citeDiv);
          });
          return popup.innerHTML;
        });
      }
    }
  });
  </script><nav class="page-navigation"><div class="nav-page nav-page-previous">
      <a href="../vignettes/modelsummary_extension.html" class="pagination-link" aria-label="Custom">
        <i class="bi bi-arrow-left-short"></i> <span class="nav-page-text">Custom</span>
      </a>          
  </div>
  <div class="nav-page nav-page-next">
      <a href="../man/modelsummary.html" class="pagination-link" aria-label="`modelsummary`">
        <span class="nav-page-text"><code>modelsummary</code></span> <i class="bi bi-arrow-right-short"></i>
      </a>
  </div>
</nav>
</div> <!-- /content -->



</body></html>